summaryrefslogtreecommitdiff
path: root/src/libudev
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-12-01 07:39:05 -0500
committerAnthony G. Basile <blueness@gentoo.org>2014-12-01 07:39:05 -0500
commit761b969283f415df75efe2ffb772a62b23379222 (patch)
tree66b297fd3a52397122ba44d0e4eefbd40cc6e160 /src/libudev
parented7c6787bd009fb3e16fac6cccb6c0eb2fe7705e (diff)
treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/libudev')
-rw-r--r--src/libudev/libudev-device-private.c2
-rw-r--r--src/libudev/libudev-device.c2
-rw-r--r--src/libudev/libudev-hwdb.c4
-rw-r--r--src/libudev/libudev-monitor.c8
4 files changed, 8 insertions, 8 deletions
diff --git a/src/libudev/libudev-device-private.c b/src/libudev/libudev-device-private.c
index aa3b2270e0..be3f17fd47 100644
--- a/src/libudev/libudev-device-private.c
+++ b/src/libudev/libudev-device-private.c
@@ -129,7 +129,7 @@ int udev_device_update_db(struct udev_device *udev_device)
mkdir_parents(filename_tmp, 0755);
f = fopen(filename_tmp, "we");
if (f == NULL) {
- log_debug("unable to create temporary db file '%s': %m", filename_tmp);
+ log_debug_errno(errno, "unable to create temporary db file '%s': %m", filename_tmp);
return -errno;
}
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index fc7d928721..400fb74d83 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -535,7 +535,7 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
f = fopen(dbfile, "re");
if (f == NULL) {
- log_debug("no db file to read %s: %m", dbfile);
+ log_debug_errno(errno, "no db file to read %s: %m", dbfile);
return -errno;
}
diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c
index 09e7c337b4..d457604a07 100644
--- a/src/libudev/libudev-hwdb.c
+++ b/src/libudev/libudev-hwdb.c
@@ -284,14 +284,14 @@ _public_ struct udev_hwdb *udev_hwdb_new(struct udev *udev) {
if (fstat(fileno(hwdb->f), &hwdb->st) < 0 ||
(size_t)hwdb->st.st_size < offsetof(struct trie_header_f, strings_len) + 8) {
- log_debug("error reading " UDEV_HWDB_BIN ": %m");
+ log_debug_errno(errno, "error reading " UDEV_HWDB_BIN ": %m");
udev_hwdb_unref(hwdb);
return NULL;
}
hwdb->map = mmap(0, hwdb->st.st_size, PROT_READ, MAP_SHARED, fileno(hwdb->f), 0);
if (hwdb->map == MAP_FAILED) {
- log_debug("error mapping " UDEV_HWDB_BIN ": %m");
+ log_debug_errno(errno, "error mapping " UDEV_HWDB_BIN ": %m");
udev_hwdb_unref(hwdb);
return NULL;
}
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index 6335fcc6cc..efdabf0c3c 100644
--- a/src/libudev/libudev-monitor.c
+++ b/src/libudev/libudev-monitor.c
@@ -121,7 +121,7 @@ static bool udev_has_devtmpfs(struct udev *udev) {
r = name_to_handle_at(AT_FDCWD, "/dev", &h.handle, &mount_id, 0);
if (r < 0) {
if (errno != EOPNOTSUPP)
- log_debug("name_to_handle_at on /dev: %m");
+ log_debug_errno(errno, "name_to_handle_at on /dev: %m");
return false;
}
@@ -190,7 +190,7 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c
if (fd < 0) {
udev_monitor->sock = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT);
if (udev_monitor->sock == -1) {
- log_debug("error getting socket: %m");
+ log_debug_errno(errno, "error getting socket: %m");
free(udev_monitor);
return NULL;
}
@@ -407,14 +407,14 @@ _public_ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor)
if (err == 0)
udev_monitor->snl.nl.nl_pid = snl.nl.nl_pid;
} else {
- log_debug("bind failed: %m");
+ log_debug_errno(errno, "bind failed: %m");
return -errno;
}
/* enable receiving of sender credentials */
err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on));
if (err < 0)
- log_debug("setting SO_PASSCRED failed: %m");
+ log_debug_errno(errno, "setting SO_PASSCRED failed: %m");
return 0;
}