chiark / gitweb /
Revert "journalctl: remove unexpected behavior of journalctl -b"
authorLennart Poettering <lennart@poettering.net>
Wed, 25 Dec 2013 18:17:10 +0000 (19:17 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 26 Dec 2013 00:52:45 +0000 (01:52 +0100)
This reverts commit cf5bccc2bb9569030cb04debbc4208aaca0fe5b4.

We should fix thinks properly if they aren't perfect, not just break
other things...

src/journal/journalctl.c

index b347dfa..cb252eb 100644 (file)
@@ -371,7 +371,18 @@ static int parse_argv(int argc, char *argv[]) {
 
                 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;