Fix a possible /linuxrc crash.

-Erik
This commit is contained in:
Erik Andersen 2000-02-09 06:05:01 +00:00
parent d7ce5e7802
commit 07f5604046
2 changed files with 4 additions and 2 deletions

3
init.c
View 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 */ /* Fix up argv[0] to be certain we claim to be init */
strncpy(argv[0], "init", strlen(argv[0])+1); 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 */ /* Now run everything that needs to be run */

View 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 */ /* Fix up argv[0] to be certain we claim to be init */
strncpy(argv[0], "init", strlen(argv[0])+1); 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 */ /* Now run everything that needs to be run */