1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-31 14:50:15 +03:00

journal-upload: return proper exit code

Even when termninated normally, systemd-journal-upload would return
something positive which would be interpreted as failure.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2014-10-22 23:31:56 -05:00
parent cb41ff2922
commit 36d4739a68

View File

@ -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;
}