Fix a possible /linuxrc crash.
authorErik Andersen <andersen@codepoet.org>
Wed, 9 Feb 2000 06:05:01 +0000 (06:05 -0000)
committerErik Andersen <andersen@codepoet.org>
Wed, 9 Feb 2000 06:05:01 +0000 (06:05 -0000)
 -Erik

init.c
init/init.c

diff --git a/init.c b/init.c
index 2f2203b..0157873 100644 (file)
--- a/init.c
+++ b/init.c
@@ -879,7 +879,8 @@ extern int init_main(int argc, char **argv)
        
        /* Fix up argv[0] to be certain we claim to be init */
        strncpy(argv[0], "init", strlen(argv[0])+1);
-       strncpy(argv[1], "\0", strlen(argv[1])+1);
+       if (argc > 1)
+               strncpy(argv[1], "\0", strlen(argv[1])+1);
 
        /* Now run everything that needs to be run */
 
index 2f2203b..0157873 100644 (file)
@@ -879,7 +879,8 @@ extern int init_main(int argc, char **argv)
        
        /* Fix up argv[0] to be certain we claim to be init */
        strncpy(argv[0], "init", strlen(argv[0])+1);
-       strncpy(argv[1], "\0", strlen(argv[1])+1);
+       if (argc > 1)
+               strncpy(argv[1], "\0", strlen(argv[1])+1);
 
        /* Now run everything that needs to be run */