SOURCES: sysvinit-alt-fixes.patch (NEW) - saved from http://git.al...

glen glen at pld-linux.org
Tue Nov 13 11:02:44 CET 2007


Author: glen                         Date: Tue Nov 13 10:02:44 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- saved from http://git.altlinux.org/people/ldv/packages/?p=SysVinit.git;a=blob_plain;f=sysvinit-2.86-alt-fixes.patch;hb=cac77d8e646185c8616c3ae9c7f35243081efa71

---- Files affected:
SOURCES:
   sysvinit-alt-fixes.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/sysvinit-alt-fixes.patch
diff -u /dev/null SOURCES/sysvinit-alt-fixes.patch:1.1
--- /dev/null	Tue Nov 13 11:02:44 2007
+++ SOURCES/sysvinit-alt-fixes.patch	Tue Nov 13 11:02:39 2007
@@ -0,0 +1,72 @@
+diff -upk.orig sysvinit-2.86.orig/src/bootlogd.c sysvinit-2.86/src/bootlogd.c
+--- sysvinit-2.86.orig/src/bootlogd.c	2007-01-06 14:37:36 +0000
++++ sysvinit-2.86/src/bootlogd.c	2007-01-06 14:38:09 +0000
+@@ -232,6 +232,9 @@ int consolename(char *res, int rlen)
+ #ifdef TIOCGDEV
+ 	if (ioctl(0, TIOCGDEV, &kdev) == 0)
+ 		return findtty(res, rlen, (dev_t)kdev);
++#ifndef ENOIOCTLCMD
++#define ENOIOCTLCMD 515
++#endif
+ 	if (errno != ENOIOCTLCMD) return -1;
+ #endif
+ 
+diff -upk.orig sysvinit-2.86.orig/src/init.c sysvinit-2.86/src/init.c
+--- sysvinit-2.86.orig/src/init.c	2007-01-06 14:37:36 +0000
++++ sysvinit-2.86/src/init.c	2007-01-06 14:38:09 +0000
+@@ -785,7 +785,7 @@ char **init_buildenv(int child)
+ 	for (n = 0; environ[n]; n++)
+ 		;
+ 	n += NR_EXTRA_ENV + 8;
+-	e = calloc(n, sizeof(char *));
++	e = imalloc(n * sizeof(char *));
+ 
+ 	for (n = 0; environ[n]; n++)
+ 		e[n] = istrdup(environ[n]);
+@@ -814,6 +814,9 @@ void init_freeenv(char **e)
+ {
+ 	int		n;
+ 
++	if (!e)
++		return;
++
+ 	for (n = 0; e[n]; n++)
+ 		free(e[n]);
+ 	free(e);
+@@ -1834,7 +1837,7 @@ void re_exec(void)
+ 	CHILD		*ch;
+ 	sigset_t	mask, oldset;
+ 	pid_t		pid;
+-	char		**env;
++	char		**env = 0;
+ 	int		fd;
+ 
+ 	if (strchr("S0123456",runlevel) == NULL)
+@@ -1882,11 +1885,13 @@ void re_exec(void)
+ 		exit(0);
+ 	}
+ 
+-	/*
+-	 *	The existing init process execs a new init binary.
+-	 */
+-	env = init_buildenv(0);
+-	execle(myname, myname, "--init", NULL, env);
++	if (pid > 0) {
++		/*
++		 *	The existing init process execs a new init binary.
++		 */
++		env = init_buildenv(0);
++		execle(myname, myname, "--init", NULL, env);
++	}
+ 
+ 	/*
+ 	 *	We shouldn't be here, something failed. 
+@@ -2557,7 +2562,7 @@ int telinit(const char *progname, int ar
+ 		if (!strchr("0123456789SsQqAaBbCcUu", argv[optind][0]))
+ 			usage(progname);
+ 		request.cmd = INIT_CMD_RUNLVL;
+-		request.runlevel  = env ? 0 : argv[optind][0];
++		request.runlevel  = argv[optind][0];
+ 		request.sleeptime = sltime;
+ 	}
+ 
================================================================


More information about the pld-cvs-commit mailing list