X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fjournal%2Fjournalctl.c;h=019629047b02a5bc445adec70f3909d86881311a;hp=482795bd38a43be085e2e2c109434bafbd88bf00;hb=03e334a1c7dc8c20c38902aa039440763acc9b17;hpb=2d5bdf5bc0e4714d42e5999a4e37553a6bf83575 diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index 482795bd3..019629047 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -658,6 +658,11 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; } + if (arg_action != ACTION_SHOW && optind < argc) { + log_error("Extraneous arguments starting with '%s'", argv[optind]); + return -EINVAL; + } + return 1; } @@ -727,7 +732,7 @@ static int add_matches(sd_journal *j, char **args) { t = strappend("_COMM=", comm); /* Append _EXE only if the interpreter is not a link. - Otherwise it might be outdated often. */ + Otherwise, it might be outdated often. */ if (lstat(interpreter, &st) == 0 && !S_ISLNK(st.st_mode)) { t2 = strappend("_EXE=", interpreter); @@ -1285,7 +1290,7 @@ static int setup_keys(void) { n = now(CLOCK_REALTIME); n /= arg_interval; - close_nointr_nofail(fd); + safe_close(fd); fd = mkostemp_safe(k, O_WRONLY|O_CLOEXEC); if (fd < 0) { log_error("Failed to open %s: %m", k); @@ -1384,8 +1389,7 @@ static int setup_keys(void) { r = 0; finish: - if (fd >= 0) - close_nointr_nofail(fd); + safe_close(fd); if (k) { unlink(k); @@ -1651,7 +1655,7 @@ int main(int argc, char *argv[]) { } if (arg_action == ACTION_DISK_USAGE) { - uint64_t bytes; + uint64_t bytes = 0; char sbytes[FORMAT_BYTES_MAX]; r = sd_journal_get_usage(j, &bytes);