]> git.pld-linux.org Git - packages/SysVinit.git/blob - sysvinit-alt-fixes.patch
- updated to 3.04
[packages/SysVinit.git] / sysvinit-alt-fixes.patch
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;
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]);
12 @@ -911,6 +911,9 @@ void init_freeenv(char **e)
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);
22 @@ -1976,7 +1979,7 @@ void re_exec(void)
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)
31 @@ -2027,8 +2030,13 @@ void re_exec(void)
32         /*
33          *      The existing init process execs a new init binary.
34          */
35 -       env = init_buildenv(0);
36 -       execle(myname, myname, "--init", NULL, env);
37 +       if (pid > 0) {
38 +               /*
39 +                *      The existing init process execs a new init binary.
40 +                */
41 +               env = init_buildenv(0);
42 +               execle(myname, myname, "--init", NULL, env);
43 +       }
44  
45         /*
46          *      We shouldn't be here, something failed. 
47 @@ -2729,7 +2737,7 @@ int telinit(char *progname, int argc, ch
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.050029 seconds and 3 git commands to generate.