]>
Commit | Line | Data |
---|---|---|
9ba3a401 ER |
1 | diff -upk.orig sysvinit-2.86.orig/src/bootlogd.c sysvinit-2.86/src/bootlogd.c |
2 | --- sysvinit-2.86.orig/src/bootlogd.c 2007-01-06 14:37:36 +0000 | |
3 | +++ sysvinit-2.86/src/bootlogd.c 2007-01-06 14:38:09 +0000 | |
4 | @@ -232,6 +232,9 @@ int consolename(char *res, int rlen) | |
5 | #ifdef TIOCGDEV | |
6 | if (ioctl(0, TIOCGDEV, &kdev) == 0) | |
7 | return findtty(res, rlen, (dev_t)kdev); | |
8 | +#ifndef ENOIOCTLCMD | |
9 | +#define ENOIOCTLCMD 515 | |
10 | +#endif | |
11 | if (errno != ENOIOCTLCMD) return -1; | |
12 | #endif | |
13 | ||
14 | diff -upk.orig sysvinit-2.86.orig/src/init.c sysvinit-2.86/src/init.c | |
15 | --- sysvinit-2.86.orig/src/init.c 2007-01-06 14:37:36 +0000 | |
16 | +++ sysvinit-2.86/src/init.c 2007-01-06 14:38:09 +0000 | |
17 | @@ -785,7 +785,7 @@ char **init_buildenv(int child) | |
18 | for (n = 0; environ[n]; n++) | |
19 | ; | |
20 | n += NR_EXTRA_ENV + 8; | |
21 | - e = calloc(n, sizeof(char *)); | |
22 | + e = imalloc(n * sizeof(char *)); | |
23 | ||
24 | for (n = 0; environ[n]; n++) | |
25 | e[n] = istrdup(environ[n]); | |
26 | @@ -814,6 +814,9 @@ void init_freeenv(char **e) | |
27 | { | |
28 | int n; | |
29 | ||
30 | + if (!e) | |
31 | + return; | |
32 | + | |
33 | for (n = 0; e[n]; n++) | |
34 | free(e[n]); | |
35 | free(e); | |
36 | @@ -1834,7 +1837,7 @@ void re_exec(void) | |
37 | CHILD *ch; | |
38 | sigset_t mask, oldset; | |
39 | pid_t pid; | |
40 | - char **env; | |
41 | + char **env = 0; | |
42 | int fd; | |
43 | ||
44 | if (strchr("S0123456",runlevel) == NULL) | |
d2ec252e | 45 | @@ -1885,11 +1885,13 @@ |
9ba3a401 ER |
46 | exit(0); |
47 | } | |
48 | ||
49 | - /* | |
50 | - * The existing init process execs a new init binary. | |
51 | - */ | |
52 | - env = init_buildenv(0); | |
d2ec252e | 53 | - execl(myname, myname, "--init", NULL, env); |
9ba3a401 ER |
54 | + if (pid > 0) { |
55 | + /* | |
56 | + * The existing init process execs a new init binary. | |
57 | + */ | |
58 | + env = init_buildenv(0); | |
d2ec252e | 59 | + execl(myname, myname, "--init", NULL, env); |
9ba3a401 ER |
60 | + } |
61 | ||
62 | /* | |
63 | * We shouldn't be here, something failed. | |
64 | @@ -2557,7 +2562,7 @@ int telinit(const char *progname, int ar | |
65 | if (!strchr("0123456789SsQqAaBbCcUu", argv[optind][0])) | |
66 | usage(progname); | |
67 | request.cmd = INIT_CMD_RUNLVL; | |
68 | - request.runlevel = env ? 0 : argv[optind][0]; | |
69 | + request.runlevel = argv[optind][0]; | |
70 | request.sleeptime = sltime; | |
71 | } | |
72 |