chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
log: also set errno to the passed error code before processing format string in log_s...
[elogind.git]
/
src
/
udev
/
udev-builtin-net_setup_link.c
diff --git
a/src/udev/udev-builtin-net_setup_link.c
b/src/udev/udev-builtin-net_setup_link.c
index 739221ba2b3f4f8f6f305842d587198aea4dca68..14351de6a6ebb1f73027cce10be9ac0fd8472d54 100644
(file)
--- a/
src/udev/udev-builtin-net_setup_link.c
+++ b/
src/udev/udev-builtin-net_setup_link.c
@@
-23,9
+23,11
@@
#include "udev.h"
#include "log.h"
#include "udev.h"
#include "log.h"
-
link_config_ctx *ctx
;
+
static link_config_ctx *ctx = NULL
;
static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv, bool test) {
static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv, bool test) {
+ _cleanup_free_ char *driver = NULL;
+ const char *name;
link_config *link;
int r;
link_config *link;
int r;
@@
-34,23
+36,32
@@
static int builtin_net_setup_link(struct udev_device *dev, int argc, char **argv
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
+ r = link_get_driver(ctx, dev, &driver);
+ if (r >= 0)
+ udev_builtin_add_property(dev, test, "ID_NET_DRIVER", driver);
+
r = link_config_get(ctx, dev, &link);
if (r < 0) {
if (r == -ENOENT) {
r = link_config_get(ctx, dev, &link);
if (r < 0) {
if (r == -ENOENT) {
- log_debug("No matching link configuration found");
+ log_debug("No matching link configuration found
.
");
return EXIT_SUCCESS;
} else {
return EXIT_SUCCESS;
} else {
- log_error("Could not get link config
"
);
+ log_error("Could not get link config
: %s", strerror(-r)
);
return EXIT_FAILURE;
}
}
return EXIT_FAILURE;
}
}
- r = link_config_apply(ctx, link, dev);
+ r = link_config_apply(ctx, link, dev
, &name
);
if (r < 0) {
if (r < 0) {
- log_error("Could not apply link config to %s
", udev_device_get_sysname(dev
));
+ log_error("Could not apply link config to %s
: %s", udev_device_get_sysname(dev), strerror(-r
));
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}
+ udev_builtin_add_property(dev, test, "ID_NET_LINK_FILE", link->filename);
+
+ if (name)
+ udev_builtin_add_property(dev, test, "ID_NET_NAME", name);
+
return EXIT_SUCCESS;
}
return EXIT_SUCCESS;
}
@@
-68,17
+79,18
@@
static int builtin_net_setup_link_init(struct udev *udev) {
if (r < 0)
return r;
if (r < 0)
return r;
- log_debug("Created link configuration context");
+ log_debug("Created link configuration context
.
");
return 0;
}
static void builtin_net_setup_link_exit(struct udev *udev) {
link_config_ctx_free(ctx);
return 0;
}
static void builtin_net_setup_link_exit(struct udev *udev) {
link_config_ctx_free(ctx);
- log_debug("Unloaded link configuration context");
+ ctx = NULL;
+ log_debug("Unloaded link configuration context.");
}
static bool builtin_net_setup_link_validate(struct udev *udev) {
}
static bool builtin_net_setup_link_validate(struct udev *udev) {
- log_debug("Check if link configuration needs reloading");
+ log_debug("Check if link configuration needs reloading
.
");
if (!ctx)
return false;
if (!ctx)
return false;