chiark / gitweb /
Revert "journalctl: remove unexpected behavior of journalctl -b"
[elogind.git] / src / journal / journalctl.c
index b347dfa18713c5c10be152b67db7371dcba02a22..cb252eb0b89eaf282e0cbd2ce7c2efa7a58e821d 100644 (file)
@@ -371,7 +371,18 @@ static int parse_argv(int argc, char *argv[]) {
 
                 case 'b':
                         arg_boot = true;
 
                 case 'b':
                         arg_boot = true;
-                        arg_boot_descriptor = optarg;
+
+                        if (optarg)
+                                arg_boot_descriptor = optarg;
+                        else if (optind < argc) {
+                                int boot;
+
+                                if (argv[optind][0] != '-' ||
+                                    safe_atoi(argv[optind], &boot) >= 0) {
+                                        arg_boot_descriptor = argv[optind];
+                                        optind++;
+                                }
+                        }
 
                         break;
 
 
                         break;