journalctl: make --follow work with --merge again

Set --boot with --follow only if it's not already set and if --merge is
not used, since it's not compatible with --boot.

Follow-up to 2dd9285bac.
Resolves: #24565
This commit is contained in:
Frantisek Sumsal 2023-05-19 09:17:29 +02:00 committed by Yu Watanabe
parent 75edb7ca96
commit e47622a61c

View file

@ -551,11 +551,6 @@ static int parse_argv(int argc, char *argv[]) {
case 'f':
arg_follow = true;
arg_boot = true;
arg_boot_id = SD_ID128_NULL;
arg_boot_offset = 0;
break;
case 'o':
@ -1055,6 +1050,12 @@ static int parse_argv(int argc, char *argv[]) {
if (arg_follow && !arg_no_tail && !arg_since && arg_lines == ARG_LINES_DEFAULT)
arg_lines = 10;
if (arg_follow && !arg_merge && !arg_boot) {
arg_boot = true;
arg_boot_id = SD_ID128_NULL;
arg_boot_offset = 0;
}
if (!!arg_directory + !!arg_file + !!arg_machine + !!arg_root + !!arg_image > 1)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Please specify at most one of -D/--directory=, --file=, -M/--machine=, --root=, --image=.");