]> git.pld-linux.org Git - packages/SysVinit.git/blame - sysvinit-alt-fixes.patch
- fix version in C: rc-scripts
[packages/SysVinit.git] / sysvinit-alt-fixes.patch
CommitLineData
8c5b2406
AF
1--- sysvinit-2.88dsf/src/init.c.wiget 2011-12-03 23:39:16.988206898 +0100
2+++ sysvinit-2.88dsf/src/init.c 2011-12-03 23:47:53.761427001 +0100
3@@ -880,7 +880,7 @@ char **init_buildenv(int child)
4 n += NR_EXTRA_ENV;
5 if (child)
6 n += 8;
9ba3a401
ER
7- e = calloc(n, sizeof(char *));
8+ e = imalloc(n * sizeof(char *));
9
10 for (n = 0; environ[n]; n++)
11 e[n] = istrdup(environ[n]);
8c5b2406 12@@ -911,6 +911,9 @@ void init_freeenv(char **e)
9ba3a401
ER
13 {
14 int n;
15
16+ if (!e)
17+ return;
18+
19 for (n = 0; e[n]; n++)
20 free(e[n]);
21 free(e);
8c5b2406 22@@ -1976,7 +1979,7 @@ void re_exec(void)
9ba3a401
ER
23 CHILD *ch;
24 sigset_t mask, oldset;
25 pid_t pid;
26- char **env;
27+ char **env = 0;
28 int fd;
29
30 if (strchr("S0123456",runlevel) == NULL)
8c5b2406
AF
31@@ -2027,8 +2030,13 @@ void re_exec(void)
32 /*
33 * The existing init process execs a new init binary.
34 */
9ba3a401 35- env = init_buildenv(0);
8c5b2406 36- execle(myname, myname, "--init", NULL, env);
9ba3a401
ER
37+ if (pid > 0) {
38+ /*
39+ * The existing init process execs a new init binary.
40+ */
41+ env = init_buildenv(0);
e7e717de 42+ execle(myname, myname, "--init", NULL, env);
9ba3a401
ER
43+ }
44
45 /*
46 * We shouldn't be here, something failed.
8c5b2406 47@@ -2729,7 +2737,7 @@ int telinit(char *progname, int argc, ch
9ba3a401
ER
48 if (!strchr("0123456789SsQqAaBbCcUu", argv[optind][0]))
49 usage(progname);
50 request.cmd = INIT_CMD_RUNLVL;
51- request.runlevel = env ? 0 : argv[optind][0];
52+ request.runlevel = argv[optind][0];
53 request.sleeptime = sltime;
54 }
55
This page took 0.690471 seconds and 4 git commands to generate.