summaryrefslogtreecommitdiff
path: root/src/journal-remote/journal-gatewayd.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 11:58:34 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 12:04:41 +0100
commit0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (patch)
tree50117277be2e2078d0373b944a30b4f09bb94443 /src/journal-remote/journal-gatewayd.c
parentb4d23205f238e06aaa31264628e20669e714acad (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/journal-remote/journal-gatewayd.c')
-rw-r--r--src/journal-remote/journal-gatewayd.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c
index db81fe3ca3..499a5fc6a2 100644
--- a/src/journal-remote/journal-gatewayd.c
+++ b/src/journal-remote/journal-gatewayd.c
@@ -155,14 +155,14 @@ static ssize_t request_reader_entries(
r = sd_journal_next(m->journal);
if (r < 0) {
- log_error("Failed to advance journal pointer: %s", strerror(-r));
+ log_error_errno(-r, "Failed to advance journal pointer: %m");
return MHD_CONTENT_READER_END_WITH_ERROR;
} else if (r == 0) {
if (m->follow) {
r = sd_journal_wait(m->journal, (uint64_t) -1);
if (r < 0) {
- log_error("Couldn't wait for journal event: %s", strerror(-r));
+ log_error_errno(-r, "Couldn't wait for journal event: %m");
return MHD_CONTENT_READER_END_WITH_ERROR;
}
@@ -177,7 +177,7 @@ static ssize_t request_reader_entries(
r = sd_journal_test_cursor(m->journal, m->cursor);
if (r < 0) {
- log_error("Failed to test cursor: %s", strerror(-r));
+ log_error_errno(-r, "Failed to test cursor: %m");
return MHD_CONTENT_READER_END_WITH_ERROR;
}
@@ -205,7 +205,7 @@ static ssize_t request_reader_entries(
r = output_journal(m->tmp, m->journal, m->mode, 0, OUTPUT_FULL_WIDTH, NULL);
if (r < 0) {
- log_error("Failed to serialize item: %s", strerror(-r));
+ log_error_errno(-r, "Failed to serialize item: %m");
return MHD_CONTENT_READER_END_WITH_ERROR;
}
@@ -394,7 +394,7 @@ static int request_parse_arguments_iterator(
r = sd_id128_get_boot(&bid);
if (r < 0) {
- log_error("Failed to get boot ID: %s", strerror(-r));
+ log_error_errno(-r, "Failed to get boot ID: %m");
return MHD_NO;
}
@@ -543,7 +543,7 @@ static ssize_t request_reader_fields(
r = sd_journal_enumerate_unique(m->journal, &d, &l);
if (r < 0) {
- log_error("Failed to advance field index: %s", strerror(-r));
+ log_error_errno(-r, "Failed to advance field index: %m");
return MHD_CONTENT_READER_END_WITH_ERROR;
} else if (r == 0)
return MHD_CONTENT_READER_END_OF_STREAM;
@@ -566,7 +566,7 @@ static ssize_t request_reader_fields(
r = output_field(m->tmp, m->mode, d, l);
if (r < 0) {
- log_error("Failed to serialize item: %s", strerror(-r));
+ log_error_errno(-r, "Failed to serialize item: %m");
return MHD_CONTENT_READER_END_WITH_ERROR;
}
@@ -910,7 +910,7 @@ static int parse_argv(int argc, char *argv[]) {
}
r = read_full_file(optarg, &key_pem, NULL);
if (r < 0) {
- log_error("Failed to read key file: %s", strerror(-r));
+ log_error_errno(-r, "Failed to read key file: %m");
return r;
}
assert(key_pem);
@@ -923,7 +923,7 @@ static int parse_argv(int argc, char *argv[]) {
}
r = read_full_file(optarg, &cert_pem, NULL);
if (r < 0) {
- log_error("Failed to read certificate file: %s", strerror(-r));
+ log_error_errno(-r, "Failed to read certificate file: %m");
return r;
}
assert(cert_pem);
@@ -937,7 +937,7 @@ static int parse_argv(int argc, char *argv[]) {
}
r = read_full_file(optarg, &trust_pem, NULL);
if (r < 0) {
- log_error("Failed to read CA certificate file: %s", strerror(-r));
+ log_error_errno(-r, "Failed to read CA certificate file: %m");
return r;
}
assert(trust_pem);
@@ -992,7 +992,7 @@ int main(int argc, char *argv[]) {
n = sd_listen_fds(1);
if (n < 0) {
- log_error("Failed to determine passed sockets: %s", strerror(-n));
+ log_error_errno(-n, "Failed to determine passed sockets: %m");
goto finish;
} else if (n > 1) {
log_error("Can't listen on more than one socket.");