diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 11:16:51 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2014-11-28 11:16:51 -0500 |
commit | 146b012e50e133f46b920ec1f8ab1ac719011226 (patch) | |
tree | 35536165bf27dabe32ab19dba9a6ee99e1470146 /src/udev | |
parent | e72e57a66f80866f87602845c361c8f13ae54bd0 (diff) |
treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all
low-level logging calls and intrdouce log_error_errno() as log calls
that take error numbers", use sed to convert the simple cases to use
the new macros:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/'
Multi-line log_*() invocations are not covered.
And we also should add log_unit_*_errno().
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udev-builtin-keyboard.c | 2 | ||||
-rw-r--r-- | src/udev/udev-ctrl.c | 2 | ||||
-rw-r--r-- | src/udev/udev-node.c | 4 | ||||
-rw-r--r-- | src/udev/udev-rules.c | 4 | ||||
-rw-r--r-- | src/udev/udevadm-hwdb.c | 4 | ||||
-rw-r--r-- | src/udev/udevd.c | 6 |
6 files changed, 11 insertions, 11 deletions
diff --git a/src/udev/udev-builtin-keyboard.c b/src/udev/udev-builtin-keyboard.c index d6b7dbbac0..6628ac873f 100644 --- a/src/udev/udev-builtin-keyboard.c +++ b/src/udev/udev-builtin-keyboard.c @@ -62,7 +62,7 @@ static int install_force_release(struct udev_device *dev, const unsigned int *re log_debug("keyboard: updating force-release list with '%s'", codes); ret = udev_device_set_sysattr_value(atkbd, "force_release", codes); if (ret < 0) - log_error("Error writing force-release attribute: %s", strerror(-ret)); + log_error_errno(-ret, "Error writing force-release attribute: %m"); return ret; } diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c index 2fdf4561a9..7f0c957630 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -216,7 +216,7 @@ struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) { /* check peer credential of connection */ r = getpeercred(conn->sock, &ucred); if (r < 0) { - log_error("unable to receive credentials of ctrl connection: %s", strerror(-r)); + log_error_errno(-r, "unable to receive credentials of ctrl connection: %m"); goto err; } if (ucred.uid > 0) { diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c index 030e459198..f105fa28e2 100644 --- a/src/udev/udev-node.c +++ b/src/udev/udev-node.c @@ -304,7 +304,7 @@ static int node_permissions_apply(struct udev_device *dev, bool apply, r = mac_selinux_apply(devnode, label); if (r < 0) - log_error("SECLABEL: failed to set SELinux label '%s': %s", label, strerror(-r)); + log_error_errno(-r, "SECLABEL: failed to set SELinux label '%s': %m", label); else log_debug("SECLABEL: set SELinux label '%s'", label); @@ -313,7 +313,7 @@ static int node_permissions_apply(struct udev_device *dev, bool apply, r = mac_smack_apply(devnode, label); if (r < 0) - log_error("SECLABEL: failed to set SMACK label '%s': %s", label, strerror(-r)); + log_error_errno(-r, "SECLABEL: failed to set SMACK label '%s': %m", label); else log_debug("SECLABEL: set SMACK label '%s'", label); diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index be33777fe9..28b999ad87 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -1690,7 +1690,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) { r = conf_files_list_strv(&files, ".rules", NULL, rules_dirs); if (r < 0) { - log_error("failed to enumerate rules files: %s", strerror(-r)); + log_error_errno(-r, "failed to enumerate rules files: %m"); return udev_rules_unref(rules); } @@ -2711,7 +2711,7 @@ int udev_rules_apply_static_dev_perms(struct udev_rules *rules) { strscpyl(tags_dir, sizeof(tags_dir), "/run/udev/static_node-tags/", *t, "/", NULL); r = mkdir_p(tags_dir, 0755); if (r < 0) { - log_error("failed to create %s: %s", tags_dir, strerror(-r)); + log_error_errno(-r, "failed to create %s: %m", tags_dir); return r; } diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c index 4a3f35c2af..8e8059c5af 100644 --- a/src/udev/udevadm-hwdb.c +++ b/src/udev/udevadm-hwdb.c @@ -615,7 +615,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { err = conf_files_list_strv(&files, ".hwdb", root, conf_file_dirs); if (err < 0) { - log_error("failed to enumerate hwdb files: %s", strerror(-err)); + log_error_errno(-err, "failed to enumerate hwdb files: %m"); rc = EXIT_FAILURE; goto out; } @@ -648,7 +648,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { mkdir_parents(hwdb_bin, 0755); err = trie_store(trie, hwdb_bin); if (err < 0) { - log_error("Failure writing database %s: %s", hwdb_bin, strerror(-err)); + log_error_errno(-err, "Failure writing database %s: %m", hwdb_bin); rc = EXIT_FAILURE; } } diff --git a/src/udev/udevd.c b/src/udev/udevd.c index f5e116623e..2b6dc2c79c 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -989,7 +989,7 @@ static void kernel_cmdline_options(struct udev *udev) { r = proc_cmdline(&line); if (r < 0) { - log_warning("Failed to read /proc/cmdline, ignoring: %s", strerror(-r)); + log_warning_errno(-r, "Failed to read /proc/cmdline, ignoring: %m"); return; } @@ -1161,7 +1161,7 @@ int main(int argc, char *argv[]) { r = mac_selinux_init("/dev"); if (r < 0) { - log_error("could not initialize labelling: %s", strerror(-r)); + log_error_errno(-r, "could not initialize labelling: %m"); goto exit; } @@ -1245,7 +1245,7 @@ int main(int argc, char *argv[]) { rc = udev_rules_apply_static_dev_perms(rules); if (rc < 0) - log_error("failed to apply permissions on static device nodes - %s", strerror(-rc)); + log_error_errno(-rc, "failed to apply permissions on static device nodes - %m"); if (arg_daemonize) { pid_t pid; |