summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2005-02-24 01:48:44 +0000
committerMarcus Brinkmann <marcus@gnu.org>2005-02-24 01:48:44 +0000
commit9ac24fc02219f3b7bdf0cdfdf6d557a215f060f0 (patch)
tree696f98ca39683690862a45f114b64e6a6d7667e1 /init
parent9b12211004abab7dd59716b1f583c00e7ae58ebf (diff)
2005-02-24 Ben Asselstine <benasselstine@gmail.com>
* init.c (main): Only pass ARGP_NO_ERRS to argp_parse when invoked by the bootstrap filesystem. (flags): New variable.
Diffstat (limited to 'init')
-rw-r--r--init/ChangeLog6
-rw-r--r--init/init.c14
2 files changed, 16 insertions, 4 deletions
diff --git a/init/ChangeLog b/init/ChangeLog
index d66981d6..c39c970c 100644
--- a/init/ChangeLog
+++ b/init/ChangeLog
@@ -1,3 +1,9 @@
+2005-02-24 Ben Asselstine <benasselstine@gmail.com>
+
+ * init.c (main): Only pass ARGP_NO_ERRS to argp_parse when invoked
+ by the bootstrap filesystem.
+ (flags): New variable.
+
2002-05-07 Roland McGrath <roland@frob.com>
* init.c (reboot_system): u_int -> size_t
diff --git a/init/init.c b/init/init.c
index 125084a9..d7e42467 100644
--- a/init/init.c
+++ b/init/init.c
@@ -529,13 +529,19 @@ main (int argc, char **argv, char **envp)
{
volatile int err;
int i;
+ int flags;
mach_port_t consdev;
struct argp argp = { options, parse_opt, 0, doc };
- /* Parse the arguments. We don't want the vector reordered,
- we should pass on to our child the exact arguments we got
- and just ignore any arguments that aren't flags for us. */
- argp_parse (&argp, argc, argv, ARGP_NO_ERRS|ARGP_IN_ORDER, 0, 0);
+ /* Parse the arguments. We don't want the vector reordered, we
+ should pass on to our child the exact arguments we got and just
+ ignore any arguments that aren't flags for us. ARGP_NO_ERRS
+ suppresses --help and --version, so we only use that option if we
+ are booting. */
+ flags = ARGP_IN_ORDER;
+ if (getpid () == 0)
+ flags |= ARGP_NO_ERRS;
+ argp_parse (&argp, argc, argv, flags, 0, 0);
if (getpid () > 0)
error (2, 0, "can only be run by bootstrap filesystem");