---- sysvinit-2.78/src/shutdown.c.foo Tue Aug 28 22:19:45 2001
-+++ sysvinit-2.78/src/shutdown.c Tue Aug 28 22:22:02 2001
-@@ -201,6 +201,7 @@
- }
+--- sysvinit-2.86/src/shutdown.c.orig 2004-07-30 13:59:04.000000000 +0200
++++ sysvinit-2.86/src/shutdown.c 2004-12-26 22:58:22.690343288 +0100
+@@ -324,6 +324,7 @@
+ }
#endif
-+ unlink("/.autofsck");
- /* script failed or not present: do it ourself. */
- sleep(1); /* Give init the chance to collect zombies. */
- setenv("PATH", "/bin:/sbin:/usr/bin:/usr/sbin", 1);
++ unlink("/.autofsck");
+ /* script failed or not present: do it ourself. */
+ sleep(1); /* Give init the chance to collect zombies. */
+
-diff -ru sysvinit-2.85/src/killall5.c sysvinit-2.85-fixed/src/killall5.c
---- sysvinit-2.85/src/killall5.c 2003-05-23 00:24:47.000000000 -0400
-+++ sysvinit-2.85-fixed/src/killall5.c 2003-05-23 00:23:57.000000000 -0400
-@@ -170,6 +170,7 @@
- n = p->next;
- if (p->fullname) free(p->fullname);
+--- sysvinit-2.86/src/killall5.c.orig 2004-12-26 23:07:15.505343096 +0100
++++ sysvinit-2.86/src/killall5.c 2004-12-26 23:20:43.017582576 +0100
+@@ -193,6 +193,7 @@
+ if (p->argv0) free(p->argv0);
+ if (p->argv1) free(p->argv1);
if (p->pathname) free(p->pathname);
+ if (p->statname) free(p->statname);
free(p);
}
plist = NULL;
-@@ -187,7 +188,7 @@
+@@ -210,7 +211,7 @@
/* Open the status file. */
snprintf(path, sizeof(path), "/proc/%s/stat", d->d_name);
+ /* Read statname from it. */
if ((fp = fopen(path, "r")) != NULL) {
buf[0] = 0;
- fgets(buf, 256, fp);
-@@ -200,7 +201,6 @@
+ fgets(buf, sizeof(buf), fp);
+@@ -223,11 +224,11 @@
/* Read program name. */
q = strrchr(buf, ')');
if (q == NULL) {
nsyslog(LOG_ERR,
"can't get program name from %s\n",
path);
-@@ -213,24 +213,21 @@
- while (*q != ' ') q++;
- }
- *q++ = 0;
-- while (*q == ' ') q++;
- p->statname = (char *)xmalloc(strlen(s)+1);
- strcpy(p->statname, s);
--
-- /* This could be replaced by getsid(pid) */
-- if (sscanf(q, "%*c %*d %*d %d", &p->sid) != 1) {
-- p->sid = 0;
+ free(p);
++ fclose(fp);
+ continue;
+ }
+ s++;
+@@ -242,20 +243,23 @@
+
+ /* Get session, startcode, endcode. */
+ startcode = endcode = 0;
+- if (sscanf(q, "%*c %*d %*d %d %*d %*d %*u %*u "
++ if (sscanf(q, "%*c %*d %*d %*d %*d %*d %*u %*u "
+ "%*u %*u %*u %*u %*u %*d %*d "
+ "%*d %*d %*d %*d %*u %*u %*d "
+ "%*u %lu %lu",
+- &p->sid, &startcode, &endcode) != 3) {
++ &startcode, &endcode) == 2) {
++ if (startcode == 0 && endcode == 0)
++ p->kernel = 1;
++ }
++ fclose(fp);
++ p->sid = getsid(pid);
++ if (p->sid < 0) {
+ p->sid = 0;
- nsyslog(LOG_ERR, "can't read sid from %s\n",
- path);
-- free(p);
-- continue;
-- }
- fclose(fp);
++ nsyslog(LOG_ERR, "can't read sid for pid %d\n", pid);
++ free(p->statname);
+ free(p);
+ continue;
+ }
+- if (startcode == 0 && endcode == 0)
+- p->kernel = 1;
+- fclose(fp);
} else {
/* Process disappeared.. */
free(p);
- continue;
- }
-+ p->sid = getsid(pid);
-+ if (p->sid < 0) {
-+ p->sid = 0;
-+ nsyslog(LOG_ERR, "can't read sid for pid %d\n", pid);
-+ free(p);
-+ continue;
-+ }
-
- /* Now read argv[0] */
- snprintf(path, sizeof(path), "/proc/%s/cmdline", d->d_name);
-@@ -553,11 +550,7 @@
- }
-
- pid = getpid();
-- for (p = plist; p; p = p->next)
-- if (p->pid == pid) {
-- sid = p->sid;
-- break;
-- }
-+ sid = getsid(0);
-
- /* Now kill all processes except our session. */
- for (p = plist; p; p = p->next)
-diff -Nru sysvinit-2.85.orig/src/Makefile sysvinit-2.85/src/Makefile
---- sysvinit-2.85.orig/src/Makefile Tue Nov 6 12:58:16 2001
-+++ sysvinit-2.85/src/Makefile Thu Apr 24 12:05:06 2003
-@@ -8,8 +8,9 @@
- # Version: @(#)Makefile 2.83-3 06-Nov-2001 miquels@cistron.nl
+--- sysvinit-2.86/src/Makefile.orig 2004-06-09 14:47:45.000000000 +0200
++++ sysvinit-2.86/src/Makefile 2004-12-26 22:40:47.622737944 +0100
+@@ -9,7 +9,8 @@
#
--CC = cc
--CFLAGS = -Wall -O2 -D_GNU_SOURCE
-+CC = gcc
-+OPTIMIZE = -O2
+ CC = gcc
+-CFLAGS = -Wall -O2 -fomit-frame-pointer -D_GNU_SOURCE
++OPTIMIZE = -O2 -fomit-frame-pointer
+CFLAGS = -Wall $(OPTIMIZE) -D_GNU_SOURCE
LDFLAGS = -s
STATIC =
-@@ -89,7 +90,8 @@
- runlevel shutdown $(ROOT)/sbin
- # These are not installed by default
- ifeq ($(DEBIAN),)
-- $(INSTALL) -m 555 utmpdump wall $(ROOT)/usr/bin
-+ $(INSTALL) -m 755 wall $(ROOT)/usr/bin
-+ $(INSTALL) -m 755 utmpdump $(ROOT)/usr/bin/utmpx-dump
+@@ -26,7 +27,7 @@
+ ifeq ($(DISTRO),)
+ BIN += mountpoint
+ SBIN += sulogin bootlogd
+-USRBIN += utmpdump wall
++USRBIN += utmpx-dump wall
+ MAN1 += mountpoint.1 wall.1
+ MAN8 += sulogin.8 bootlogd.8
endif
- # $(INSTALL) -m 755 etc/initscript.sample $(ROOT)/etc
- $(INSTALL) -m 755 mesg last $(ROOT)/usr/bin
-diff -Nru sysvinit-2.85.orig/src/paths.h sysvinit-2.85/src/paths.h
---- sysvinit-2.85.orig/src/paths.h Mon Apr 14 13:37:01 2003
-+++ sysvinit-2.85/src/paths.h Thu Apr 24 12:06:06 2003
-@@ -24,7 +24,7 @@
- #define FORCEFSCK "/forcefsck" /* Force fsck on boot */
+@@ -71,7 +72,7 @@
+ mountpoint: mountpoint.o
+ $(CC) $(LDFLAGS) -o $@ mountpoint.o
+
+-utmpdump: utmpdump.o
++utmpx-dump: utmpdump.o
+ $(CC) $(LDFLAGS) -o $@ utmpdump.o
+
+ runlevel: runlevel.o
+--- sysvinit-2.86/src/paths.h.orig 2004-06-09 14:47:45.000000000 +0200
++++ sysvinit-2.86/src/paths.h 2004-12-26 22:41:21.122645184 +0100
+@@ -25,7 +25,7 @@
#define SDPID "/var/run/shutdown.pid" /* PID of shutdown program */
#define SHELL "/bin/sh" /* Default shell */
+ #define SULOGIN "/sbin/sulogin" /* Sulogin */
-#define INITSCRIPT "/etc/initscript" /* Initscript. */
+#define INITSCRIPT "/etc/rc.d/rc.init" /* Initscript. */
#define PWRSTAT "/etc/powerstatus" /* COMPAT: SIGPWR reason (OK/BAD) */
---- sysvinit-2.84/src/killall5.c.foo 2002-07-18 21:48:55.000000000 -0400
-+++ sysvinit-2.84/src/killall5.c 2002-07-18 22:00:14.000000000 -0400
-@@ -45,6 +45,7 @@
+--- sysvinit-2.86/src/killall5.c.orig 2004-07-30 14:16:23.000000000 +0200
++++ sysvinit-2.86/src/killall5.c 2004-12-26 23:05:17.284315424 +0100
+@@ -47,8 +47,9 @@
+
/* Info about a process. */
- typedef struct _proc_
- {
-+ char *pathname; /* full path to executable */
- char *fullname; /* Name as found out from argv[0] */
- char *basename; /* Only the part after the last / */
- char *statname; /* the statname without braces */
-@@ -165,6 +166,7 @@
- for (p = plist; n; p = n) {
+ typedef struct proc {
++ char *pathname; /* full path to executable */
+ char *argv0; /* Name as found out from argv[0] */
+- char *argv0base; /* `basename argv[1]` */
++ char *argv0base; /* `basename argv[0]` */
+ char *argv1; /* Name as found out from argv[1] */
+ char *argv1base; /* `basename argv[1]` */
+ char *statname; /* the statname without braces */
+@@ -191,6 +192,7 @@
n = p->next;
- if (p->fullname) free(p->fullname);
+ if (p->argv0) free(p->argv0);
+ if (p->argv1) free(p->argv1);
+ if (p->pathname) free(p->pathname);
free(p);
}
plist = NULL;
-@@ -256,6 +258,8 @@
+@@ -309,6 +311,8 @@
if (stat(path, &st) == 0) {
p->dev = st.st_dev;
p->ino = st.st_ino;
}
/* Link it into the list. */
-@@ -360,6 +364,9 @@
- strchr(p->fullname, ' ') ||
- scripts_too)
- ok += (strcmp(p->statname, s) == 0);
+@@ -425,6 +429,10 @@
+ strchr(p->argv0, ' '))) {
+ ok += (strcmp(p->statname, s) == 0);
+ }
+
-+ if (prog[0] == '/' && p->pathname && strcmp(prog,p->pathname))
-+ ok = 0;
++ if (prog[0] == '/' && p->pathname && strcmp(prog, p->pathname))
++ ok = 0;
++
+ if (ok) add_pid_to_q(q, p);
+ }
- if (ok) add_pid_to_q(q, p);
- }