diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 17:09:20 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 17:17:51 +0100 |
commit | c33b329709ebe2755181980a050d02ec7c81ed87 (patch) | |
tree | 39080c428c72c90daddbe1c08d45c181adf1476c /src/journal-remote/journal-upload.c | |
parent | hostnamectl: Exit with zero on success (diff) | |
download | systemd-c33b329709ebe2755181980a050d02ec7c81ed87.tar.xz systemd-c33b329709ebe2755181980a050d02ec7c81ed87.zip |
treewide: more log_*_errno() conversions, multiline calls
Basically:
find . -name '*.[ch]' | while read f; do perl -i.mmm -e \
'local $/;
local $_=<>;
s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \
$f; done
Plus manual indentation fixups.
Diffstat (limited to 'src/journal-remote/journal-upload.c')
-rw-r--r-- | src/journal-remote/journal-upload.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index 0b9a817b23..e677e13348 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -87,8 +87,8 @@ static size_t output_callback(char *buf, if (nmemb && !u->answer) { u->answer = strndup(buf, size*nmemb); if (!u->answer) - log_warning("Failed to store server answer (%zu bytes): %s", - size*nmemb, strerror(ENOMEM)); + log_warning_errno(ENOMEM, "Failed to store server answer (%zu bytes): %m", + size*nmemb); } return size * nmemb; @@ -104,15 +104,15 @@ static int check_cursor_updating(Uploader *u) { r = mkdir_parents(u->state_file, 0755); if (r < 0) { - log_error("Cannot create parent directory of state file %s: %s", - u->state_file, strerror(-r)); + log_error_errno(r, "Cannot create parent directory of state file %s: %m", + u->state_file); return r; } r = fopen_temporary(u->state_file, &f, &temp_path); if (r < 0) { - log_error("Cannot save state to %s: %s", - u->state_file, strerror(-r)); + log_error_errno(r, "Cannot save state to %s: %m", + u->state_file); return r; } unlink(temp_path); @@ -165,8 +165,8 @@ static int load_cursor_state(Uploader *u) { if (r == -ENOENT) log_debug("State file %s is not present.", u->state_file); else if (r < 0) { - log_error("Failed to read state file %s: %s", - u->state_file, strerror(-r)); + log_error_errno(r, "Failed to read state file %s: %m", + u->state_file); return r; } else log_debug("Last cursor was %s", u->last_cursor); @@ -786,9 +786,8 @@ static int open_journal(sd_journal **j) { else r = sd_journal_open(j, !arg_merge*SD_JOURNAL_LOCAL_ONLY + arg_journal_type); if (r < 0) - log_error("Failed to open %s: %s", - arg_directory ? arg_directory : arg_file ? "files" : "journal", - strerror(-r)); + log_error_errno(r, "Failed to open %s: %m", + arg_directory ? arg_directory : arg_file ? "files" : "journal"); return r; } |