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/tmpfiles/tmpfiles.c | |
parent | b4d23205f238e06aaa31264628e20669e714acad (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().
Diffstat (limited to 'src/tmpfiles/tmpfiles.c')
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 23fd6ca3bc..c44dcff514 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -668,7 +668,7 @@ static int create_item(Item *i) { struct stat a, b; if (r != -EEXIST) { - log_error("Failed to copy files to %s: %s", i->path, strerror(-r)); + log_error_errno(-r, "Failed to copy files to %s: %m", i->path); return -r; } @@ -711,7 +711,7 @@ static int create_item(Item *i) { if (r < 0) { if (r != -EEXIST) { - log_error("Failed to create directory %s: %s", i->path, strerror(-r)); + log_error_errno(-r, "Failed to create directory %s: %m", i->path); return r; } @@ -762,7 +762,7 @@ static int create_item(Item *i) { } if (r < 0) { - log_error("Failed to create fifo %s: %s", i->path, strerror(-r)); + log_error_errno(-r, "Failed to create fifo %s: %m", i->path); return r; } } else { @@ -801,7 +801,7 @@ static int create_item(Item *i) { mac_selinux_create_file_clear(); if (r < 0) { - log_error("symlink(%s, %s) failed: %s", i->argument, i->path, strerror(-r)); + log_error_errno(-r, "symlink(%s, %s) failed: %m", i->argument, i->path); return r; } } else { @@ -863,7 +863,7 @@ static int create_item(Item *i) { } if (r < 0) { - log_error("Failed to create device node %s: %s", i->path, strerror(-r)); + log_error_errno(-r, "Failed to create device node %s: %m", i->path); return r; } } else { @@ -939,7 +939,7 @@ static int remove_item_instance(Item *i, const char *instance) { * instead of rm_rf() so that 'x' is honoured. */ r = rm_rf_dangerous(instance, false, i->type == RECURSIVE_REMOVE_PATH, false); if (r < 0 && r != -ENOENT) { - log_error("rm_rf(%s): %s", instance, strerror(-r)); + log_error_errno(-r, "rm_rf(%s): %m", instance); return r; } @@ -1398,7 +1398,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { r = hashmap_put(h, i->path, i); if (r < 0) { - log_error("Failed to insert item %s: %s", i->path, strerror(-r)); + log_error_errno(-r, "Failed to insert item %s: %m", i->path); return r; } @@ -1531,7 +1531,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) { if (ignore_enoent && r == -ENOENT) return 0; - log_error("Failed to open '%s', ignoring: %s", fn, strerror(-r)); + log_error_errno(-r, "Failed to open '%s', ignoring: %m", fn); return r; } @@ -1629,7 +1629,7 @@ int main(int argc, char *argv[]) { r = conf_files_list_nulstr(&files, ".conf", arg_root, conf_file_dirs); if (r < 0) { - log_error("Failed to enumerate tmpfiles.d files: %s", strerror(-r)); + log_error_errno(-r, "Failed to enumerate tmpfiles.d files: %m"); goto finish; } |