Skip to content

Commit

Permalink
journalctl: turn --unit= in combination with --user into --user-unit=
Browse files Browse the repository at this point in the history
Let's be nice to users, and let's turn the nonsensical "--unit=… --user" into
"--user-unit=…" which the user more likely meant.

Fixes #1621
  • Loading branch information
poettering committed Apr 25, 2016
1 parent 2aab2fa commit 52051dd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/journal/journalctl.c
Expand Up @@ -873,6 +873,18 @@ static int parse_argv(int argc, char *argv[]) {
return -EINVAL;
}

if (!strv_isempty(arg_system_units) && (arg_journal_type == SD_JOURNAL_CURRENT_USER)) {

/* Specifying --user and --unit= at the same time makes no sense (as the former excludes the user
* journal, but the latter excludes the system journal, thus resulting in empty output). Let's be nice
* to users, and automatically turn --unit= into --user-unit= if combined with --user. */

This comment has been minimized.

Copy link
@oconnor663

oconnor663 Apr 25, 2016

I think "former" and "latter" got swapped in this comment. Also thank you! :)

r = strv_extend_strv(&arg_user_units, arg_system_units, true);
if (r < 0)
return -ENOMEM;

arg_system_units = strv_free(arg_system_units);
}

return 1;
}

Expand Down

0 comments on commit 52051dd

Please sign in to comment.