summaryrefslogtreecommitdiff
path: root/src/libudev
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 19:29:59 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 19:49:27 +0100
commit56f64d95763a799ba4475daf44d8e9f72a1bd474 (patch)
tree4c38253c718dc1972b811fa7c01ebfa3c2b7776c /src/libudev
parent895b3a7b44fe7ca2f260986be2a877ff56a72718 (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.
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.c6
-rw-r--r--src/libudev/libudev-monitor.c8
4 files changed, 9 insertions, 9 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 1d0d407208..05a685868f 100644
--- a/src/libudev/libudev-hwdb.c
+++ b/src/libudev/libudev-hwdb.c
@@ -289,7 +289,7 @@ _public_ struct udev_hwdb *udev_hwdb_new(struct udev *udev) {
else if (errno == ENOENT)
continue;
else {
- log_debug("error reading %s: %m", hwdb_bin_path);
+ log_debug_errno(errno, "error reading %s: %m", hwdb_bin_path);
udev_hwdb_unref(hwdb);
return NULL;
}
@@ -303,14 +303,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 %s: %m", hwdb_bin_path);
+ log_debug_errno(errno, "error reading %s: %m", hwdb_bin_path);
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 %s: %m", hwdb_bin_path);
+ log_debug_errno(errno, "error mapping %s: %m", hwdb_bin_path);
udev_hwdb_unref(hwdb);
return NULL;
}
diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c
index bdb5516047..e8d6b4a61b 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;
}