summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-22 23:31:56 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-10-23 00:31:56 -0400
commit36d4739a68c3edafe4d145d525a26de4ef0b8e5a (patch)
tree52108d6a41d5594aa5eff756e84aa5e05dd916f7
parentcb41ff2922b8a555c01d52e1038ac26360253c15 (diff)
journal-upload: return proper exit code
Even when termninated normally, systemd-journal-upload would return something positive which would be interpreted as failure.
-rw-r--r--src/journal-remote/journal-upload.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c
index fc095c3635..9f13ffdbfe 100644
--- a/src/journal-remote/journal-upload.c
+++ b/src/journal-remote/journal-upload.c
@@ -162,11 +162,14 @@ static int load_cursor_state(Uploader *u) {
"LAST_CURSOR", &u->last_cursor,
NULL);
- if (r < 0 && r != -ENOENT) {
+ 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));
return r;
- }
+ } else
+ log_debug("Last cursor was %s", u->last_cursor);
return 0;
}
@@ -837,6 +840,12 @@ int main(int argc, char **argv) {
"STATUS=Processing input...");
while (true) {
+ r = sd_event_get_state(u.events);
+ if (r < 0)
+ break;
+ if (r == SD_EVENT_FINISHED)
+ break;
+
if (use_journal) {
if (!u.journal)
break;
@@ -852,12 +861,6 @@ int main(int argc, char **argv) {
if (r < 0)
goto cleanup;
- r = sd_event_get_state(u.events);
- if (r < 0)
- break;
- if (r == SD_EVENT_FINISHED)
- break;
-
if (u.uploading) {
r = perform_upload(&u);
if (r < 0)
@@ -879,5 +882,5 @@ cleanup:
destroy_uploader(&u);
finish:
- return r == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+ return r >= 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}