diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 11:58:34 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 12:04:41 +0100 |
commit | 0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (patch) | |
tree | 50117277be2e2078d0373b944a30b4f09bb94443 /src/gpt-auto-generator | |
parent | b4d23205f238e06aaa31264628e20669e714acad (diff) | |
download | systemd-0a1beeb64207eaa88ab9236787b1cbc2f704ae14.tar.gz systemd-0a1beeb64207eaa88ab9236787b1cbc2f704ae14.tar.bz2 systemd-0a1beeb64207eaa88ab9236787b1cbc2f704ae14.zip |
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().
Diffstat (limited to 'src/gpt-auto-generator')
-rw-r--r-- | src/gpt-auto-generator/gpt-auto-generator.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c index 9251ddff75..7deee3fc44 100644 --- a/src/gpt-auto-generator/gpt-auto-generator.c +++ b/src/gpt-auto-generator/gpt-auto-generator.c @@ -205,7 +205,7 @@ static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi "[Unit]\n" "JobTimeoutSec=0\n"); /* the binary handles timeouts anyway */ if (r < 0) { - log_error("Failed to write device drop-in: %s", strerror(-r)); + log_error_errno(-r, "Failed to write device drop-in: %m"); return r; } @@ -488,7 +488,7 @@ static int enumerate_partitions(dev_t devnum) { r = udev_enumerate_scan_devices(e); if (r < 0) { - log_error("Failed to enumerate partitions on %s: %s", node, strerror(-r)); + log_error_errno(-r, "Failed to enumerate partitions on %s: %m", node); return r; } @@ -713,7 +713,7 @@ static int add_root_mount(void) { log_debug("EFI loader partition unknown, exiting."); return 0; } else if (r < 0) { - log_error("Failed to read ESP partition UUID: %s", strerror(-r)); + log_error_errno(-r, "Failed to read ESP partition UUID: %m"); return r; } @@ -740,7 +740,7 @@ static int add_mounts(void) { r = get_block_device("/", &devno); if (r < 0) { - log_error("Failed to determine block device of root file system: %s", strerror(-r)); + log_error_errno(-r, "Failed to determine block device of root file system: %m"); return r; } else if (r == 0) { log_debug("Root file system not on a (single) block device."); @@ -774,7 +774,7 @@ int main(int argc, char *argv[]) { r = parse_proc_cmdline(parse_proc_cmdline_item); if (r < 0) - log_warning("Failed to parse kernel command line, ignoring: %s", strerror(-r)); + log_warning_errno(-r, "Failed to parse kernel command line, ignoring: %m"); if (!arg_enabled) { log_debug("Disabled, exiting."); |