summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-24 05:16:50 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-24 05:16:50 +0200
commit51f0e18963df1058fff2869ec108526a08bc0e43 (patch)
tree0d7c31f4be1a909dbee375061df45424f07898de /main.c
parent25e870b5f79f158ba6ac0b715248b0c3d3549325 (diff)
main: refuse excess command line arguments
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.c b/main.c
index d2721fd099..0128787d14 100644
--- a/main.c
+++ b/main.c
@@ -463,6 +463,15 @@ static int parse_argv(int argc, char *argv[]) {
return -EINVAL;
}
+ /* 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 (running_as != MANAGER_INIT && optind < argc) {
+ log_error("Excess arguments.");
+ return -EINVAL;
+ }
+
return 0;
}