summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-03-10 23:01:42 +0100
committerLennart Poettering <lennart@poettering.net>2011-03-11 00:52:31 +0100
commit099663ff8c117303af369a4d412dafed0c5614c2 (patch)
tree04d595e012ff90acc0ff7950b262d8d7f82db524 /src
parent90102b22ba0a9a6aa8ff1b9d32349e100902a8d7 (diff)
main: properly handle -b boot option
Diffstat (limited to 'src')
-rw-r--r--src/main.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index 6d1fd7d55d..5d37f804d0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -226,6 +226,8 @@ static int parse_proc_cmdline_word(const char *word) {
static const char * const rlmap[] = {
"emergency", SPECIAL_EMERGENCY_TARGET,
+ "-b", SPECIAL_EMERGENCY_TARGET,
+ "b", SPECIAL_EMERGENCY_TARGET,
"single", SPECIAL_RESCUE_TARGET,
"-s", SPECIAL_RESCUE_TARGET,
"s", SPECIAL_RESCUE_TARGET,
@@ -624,7 +626,7 @@ static int parse_argv(int argc, char *argv[]) {
assert(argc >= 1);
assert(argv);
- while ((c = getopt_long(argc, argv, "hD", options, NULL)) >= 0)
+ while ((c = getopt_long(argc, argv, "hDbsz:", options, NULL)) >= 0)
switch (c) {
@@ -800,19 +802,29 @@ static int parse_argv(int argc, char *argv[]) {
log_set_max_level(LOG_DEBUG);
break;
- case '?':
- return -EINVAL;
+ case 'b':
+ case 's':
+ case 'z':
+ /* Just to eat away the sysvinit kernel
+ * cmdline args without getopt() error
+ * messages that we'll parse in
+ * parse_proc_cmdline_word() or ignore. */
+ case '?':
default:
- log_error("Unknown option code %c", c);
- return -EINVAL;
+ if (getpid() != 1) {
+ log_error("Unknown option code %c", c);
+ return -EINVAL;
+ }
+
+ break;
}
/* PID 1 will get the kernel arguments as parameters, which we
* ignore and unconditionally read from
* /proc/cmdline. However, we need to ignore those arguments
* here. */
- if (arg_running_as != MANAGER_SYSTEM && optind < argc) {
+ if (getpid() != 1 && optind < argc) {
log_error("Excess arguments.");
return -EINVAL;
}