Hello community,
here is the log from the commit of package sysvinit for openSUSE:Factory
checked in at Thu Oct 21 18:20:44 CEST 2010.
--------
--- sysvinit/sysvinit.changes 2010-10-12 18:22:55.000000000 +0200
+++ /mounts/work_src_done/STABLE/sysvinit/sysvinit.changes 2010-10-21 12:16:19.000000000 +0200
@@ -1,0 +2,12 @@
+Thu Oct 21 12:00:26 CEST 2010 - werner@suse.de
+
+- New killporc version 2.17
+ * Use /proc/self/mountinfo to avoid system call stat(2) on
+ running binaries not located on the mount point of the
+ current handled program
+ * Avoid to be detect sub (shadow) mounts on NFS mounts
+- New showconsole 1.13
+- Correct position of string pointer in NFS struct used in
+ killall5/pidof
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
killproc-2.16.dif
killproc-2.16.tar.bz2
showconsole-1.12.dif
showconsole-1.12.tar.bz2
New:
----
killproc-2.17.dif
killproc-2.17.tar.bz2
showconsole-1.13.dif
showconsole-1.13.tar.bz2
sysvinit-2.88dsf-nfs.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ sysvinit.spec ++++++
--- /var/tmp/diff_new_pack.vILUkA/_old 2010-10-21 18:20:22.000000000 +0200
+++ /var/tmp/diff_new_pack.vILUkA/_new 2010-10-21 18:20:22.000000000 +0200
@@ -21,23 +21,23 @@
Name: sysvinit
%define MGVER 0.9.6s
%define PDVER 2.0.2
-%define KPVER 2.16
-%define SCVER 1.12
+%define KPVER 2.17
+%define SCVER 1.13
%define SIVER 2.88
%define START 0.57
License: GPLv2+
Group: System/Base
AutoReqProv: on
Version: 2.88
-Release: 19
+Release: 20
Summary: SysV-Style init
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: audit-devel libselinux-devel libsepol-devel pam-devel
Url: http://savannah.nongnu.org/projects/sysvinit/
Source: http://download.savannah.gnu.org/releases/sysvinit/sysvinit-2.88dsf.tar.bz2
-Source2: killproc-2.16.tar.bz2
+Source2: killproc-2.17.tar.bz2
Source3: powerd-2.0.2.tar.bz2
-Source4: showconsole-1.12.tar.bz2
+Source4: showconsole-1.13.tar.bz2
Source5: startpar-0.57.tar.bz2
Source6: rc.powerd
Source7: sysvinit-rpmlintrc
@@ -52,10 +52,11 @@
Patch5: sysvinit-last-ipv6-heuristic.patch
Patch6: sysvinit-2.88dsf-utf8.dif
Patch7: sysvinit-2.88dsf-selinux.patch
+Patch8: sysvinit-2.88dsf-nfs.patch
Patch20: powerd-2.0.2.dif
Patch21: powerd-2.0.2-getaddrinfo.patch
-Patch30: killproc-2.16.dif
-Patch40: showconsole-1.12.dif
+Patch30: killproc-2.17.dif
+Patch40: showconsole-1.13.dif
Patch50: startpar-0.57.dif
Requires: sysvinit-tools
Provides: sbin_init
@@ -95,6 +96,7 @@
%patch5 -p2 -b .ipv6
%patch6 -p0 -b .utf8
%patch7 -p0 -b .selinux
+%patch8 -p0 -b .nfs
%patch
pushd ../powerd-%{PDVER}
%patch20
++++++ killproc-2.16.dif -> killproc-2.17.dif ++++++
--- sysvinit/killproc-2.16.dif 2010-10-04 16:49:01.000000000 +0200
+++ /mounts/work_src_done/STABLE/sysvinit/killproc-2.17.dif 2010-10-21 12:16:18.000000000 +0200
@@ -1,534 +1,4 @@
--- .dummy
-+++ .dummy 2009-08-19 10:18:39.181901099 +0000
++++ .dummy 2010-10-21 09:54:54.587926689 +0000
@@ -0,0 +1 @@
-+this is a dummy, remove if real changes are required
---- checkproc.8
-+++ checkproc.8 2010-10-04 14:31:15.675926381 +0000
-@@ -278,6 +278,8 @@ Program is running
- No process but pid file found
- .IP 3 5
- No process and no pid file found
-+.IP 4 5
-+Program is not installed
- .RE
- .RS 5
- .IP 101 7
---- checkproc.c
-+++ checkproc.c 2010-10-04 14:44:56.355926370 +0000
-@@ -92,7 +92,6 @@ int main(int argc, char **argv)
- /* Allocate here: address optarg (current *argv) isn't freeable */
- if (optarg && !pid_file) {
- pid_file = xstrdup(optarg);
-- pid_forced = true;
- } else
- error(WRGSYNTAX, "Option -p requires pid file to read pid from\n");
- break;
-@@ -148,7 +147,8 @@ int main(int argc, char **argv)
- pid_file = (char*) xmalloc(DEFPIDLEN+strlen(basename)+1);
- pid_file = strcat(strcat(strcpy(pid_file,DEFPIDDIR),basename),DEFPIDEXT);
- }
-- }
-+ } else
-+ pid_forced = true;
-
- /* Check and verify the pid file */
- errno = 0;
-@@ -163,22 +163,27 @@ int main(int argc, char **argv)
- * the proc is dead if the specified pid can not be veryfied.
- */
- if (remember_pids(pid_file,fullname,root,flags) < 0)
-- exit(LSB_PROOFX);
-+ exit(LSB_STATUS_PROOFX);
-
- if (!remember)
- exit(LSB_STATUS_NOPROC); /* New LSB: no pid file is no job */
- }
-- /* No pid file means that we have to search in /proc/ */
- free(pid_file);
- pid_file = NULL;
-+
-+ /* No pid file means that we have to search in /proc/ */
- }
-
- if (pid_file && !st.st_size) {
- warn("Empty pid file %s for %s\n", pid_file, fullname);
-
-- /* No pid file means that we have to search in /proc/ */
- free(pid_file);
- pid_file = NULL;
-+
-+ if (pid_forced)
-+ exit(LSB_STATUS_NOPROC);
-+
-+ /* No pid file means that we have to search in /proc/ */
- }
-
- /* Check and verify the ignore file */
-@@ -205,6 +210,8 @@ int main(int argc, char **argv)
- exit(LSB_STATUS_PROOFX);
- }
- if (!remember) { /* No process found with pid file */
-+ if (pid_forced)
-+ exit(LSB_STATUS_PROOFX);
- if (pidof(fullname,root,flags) < 0)
- exit(LSB_STATUS_PROOFX);
- }
---- killproc.8
-+++ killproc.8 2010-07-20 09:30:00.775424897 +0000
-@@ -57,9 +57,11 @@ is sent. If this program is not called w
- .B killproc
- then
- .B SIGHUP
--is used. Note that if
-+is used. Note that if no signal is specified on the command line and the program
-+.B killproc
-+can not terminate a process with the default
- .B SIGTERM
--is used and does not terminate a process the signal
-+the signal
- .B SIGKILL
- is send after a few seconds (default is 5 seconds, see option
- .BR \-t ).
-@@ -240,16 +242,21 @@ or by number
- .B \-t\fI<sec>\fP
- The number
- .I <sec>
--specifies the seconds to wait between the sent signal
-+specifies the seconds to wait between the default signal
- .B SIGTERM
- and the subsequentially signal
- .B SIGKILL
- if the first
- .B SIGTERM
- does not show any result within the
--first few milli seconds. This defaults to
-+first few milli seconds. This timeout defaults to
- .B 5
--seconds.
-+seconds. On the other hand if the signal
-+.B SIGTERM
-+was explicitly used on the command line, the signal
-+.B SIGKILL
-+will be omitted, even if the process was not terminated
-+after the timeout has expired.
- .TP
- .B \-q
- This option is ignored.
-@@ -278,7 +285,7 @@ then the pid from this file is being use
- terminate the sendmail process. Other running processes are
- ignored.
- .TP
--.B killproc -p /var/myrun/lpd.pid -TERM /usr/sbin/lpd
-+.B killproc -p /var/myrun/lpd.pid /usr/sbin/lpd
- .IP
- sends the signal
- .B SIGTERM
-@@ -293,7 +300,7 @@ does not exist,
- assumes that the daemon of
- .B /usr/sbin/lpd
- is not running. The exit status
--is set to 0 for successfully delivering the given signals
-+is set to 0 for successfully delivering the default signals
- .BR SIGTERM " and " SIGKILL
- otherwise to 7 if the program was not running. It is also
- successful if
---- killproc.c
-+++ killproc.c 2010-07-20 09:35:09.234925068 +0000
-@@ -48,6 +48,7 @@ int main(int argc, char **argv)
- int process_group = 0, group_leader = 0, wait = 5, iargc = 0;
- unsigned short flags = (KILL|PIDOF|KSTOP);
- boolean pid_forced = false;
-+ boolean sig_forced = true;
-
- we_are = base_name(argv[0]);
- openlog (we_are, LOG_OPTIONS, LOG_FACILITY);
-@@ -79,11 +80,13 @@ int main(int argc, char **argv)
- memset(sig, 0, len);
- *sig = 'q'; /* set dummy option -q */
- snum = tmp;
-+ sig_forced = false;
- break;
- } else if ( (tmp = signame_to_signum(sig)) > 0 ) {
- memset(sig, 0, len);
- *sig = 'q'; /* set dummy option -q */
- snum = tmp;
-+ sig_forced = false;
- break;
- }
- }
-@@ -135,7 +138,6 @@ int main(int argc, char **argv)
- /* Allocate here: address optarg (current *argv) isn't freeable */
- if (optarg && !pid_file) {
- pid_file = xstrdup(optarg);
-- pid_forced = true;
- } else
- error(LSB_WRGSYN,"Option -p requires pid file to read pid from\n");
- break;
-@@ -195,7 +197,8 @@ int main(int argc, char **argv)
- pid_file = (char*) xmalloc(DEFPIDLEN+strlen(basename)+1);
- pid_file = strcat(strcat(strcpy(pid_file,DEFPIDDIR),basename),DEFPIDEXT);
- }
-- }
-+ } else
-+ pid_forced = true;
-
- /* Check and verify the pid file */
- errno = 0;
-@@ -215,17 +218,22 @@ int main(int argc, char **argv)
- if (!remember)
- exit(LSB_NOPROC); /* New LSB: no pid file is no job */
- }
-- /* No pid file means that we have to search in /proc/ */
- free(pid_file);
- pid_file = NULL;
-+
-+ /* No pid file means that we have to search in /proc/ */
- }
-
- if (pid_file && !st.st_size) {
- warn("Empty pid file %s for %s\n", pid_file, fullname);
-
-- /* No pid file means that we have to search in /proc/ */
- free(pid_file);
- pid_file = NULL;
-+
-+ if (pid_forced)
-+ exit(LSB_STATUS_NOPROC);
-+
-+ /* No pid file means that we have to search in /proc/ */
- }
-
- if (pid_file) { /* The case of having a pid file */
-@@ -291,7 +299,10 @@ again:
- goto again;
- }
-
-- if (snum == SIGKILL)
-+ if (snum == SIGKILL) /* SIGKILL was specified on the command line */
-+ goto badterm;
-+
-+ if (!sig_forced) /* SIGTERM was specified on the command line */
- goto badterm;
-
- if (check_pids(fullname,root,flags) < 0)
---- libinit.c
-+++ libinit.c 2010-07-27 08:56:18.146924383 +0000
-@@ -320,13 +320,15 @@ static ssize_t xread(int fd, void *inbuf
- while (1) {
- errno = 0;
- bytes = read(fd, inbuf, count);
-- if (bytes < 0 && (errno == EINTR || errno == EAGAIN))
-- continue;
-- if (bytes < 0)
-+ if (bytes < 0) {
-+ if (errno == EINTR || errno == EAGAIN)
-+ continue;
-+ if (errno == ESRCH)
-+ goto out;
- break;
-+ }
- goto out;
- }
--
- warn("xread error: %s\n", strerror(errno));
- out:
- errno = olderr;
-@@ -446,9 +448,9 @@ static pid_t getpppid(const pid_t ppid)
- goto out;
-
- if ((fp = open(proc(pid, "stat"), O_PROCMODE)) != -1) {
-- xread(fp, buf, BUFSIZ);
-+ ssize_t len = xread(fp, buf, BUFSIZ);
- close(fp);
-- if (sscanf(buf,"%*d %*s %*c %d %*d %*d", &pppid) != 1)
-+ if (len <= 0 || sscanf(buf,"%*d %*s %*c %d %*d %*d", &pppid) != 1)
- warn("can not read ppid for process %d!\n", ppid);
- }
- out:
-@@ -591,10 +593,11 @@ int pidof (const char * inname, const ch
- char ent[3];
- boolean thread;
- ssize_t len;
-+
- len = xread(fp,ent,3);
- close(fp);
-
-- if (!len)
-+ if (len <= 0)
- continue;
-
- thread = (strncmp(ent, "0 ", 2) == 0);
-@@ -673,7 +676,7 @@ int pidof (const char * inname, const ch
- * do not hold a file descriptor opened on the script file.
- */
- if (!(flags & (KTHREAD|KSHORT)) && isscrpt &&
-- (fp = openat(dfd, here(d->d_name, "cmd"), O_PROCMODE)) != -1) {
-+ (fp = openat(dfd, here(d->d_name, "cmdline"), O_PROCMODE)) != -1) {
-
- char entry[PATH_MAX+1];
- const char *scrpt = NULL;
-@@ -682,6 +685,9 @@ int pidof (const char * inname, const ch
- len = xread(fp, entry, PATH_MAX);
- close(fp);
-
-+ if (len <= 0)
-+ continue;
-+
- /* Seek for a script not for a binary */
- if (!(scrpt = checkscripts(entry, root, len, d->d_name)))
- continue;
-@@ -713,7 +719,7 @@ int pidof (const char * inname, const ch
- len = xread(fp, entry, PATH_MAX);
- close(fp);
-
-- if (!len)
-+ if (len <= 0)
- continue;
-
- comm = index(entry, ' ');
-@@ -764,7 +770,8 @@ int verify_pidfile (const char * pid_fil
- const char * root, unsigned short flags,
- const boolean ignore)
- {
-- int fp, cnt;
-+ int fp;
-+ ssize_t cnt;
- boolean isscrpt = false;
- pid_t pid;
- char *swapname = NULL, *bufp;
-@@ -789,11 +796,12 @@ int verify_pidfile (const char * pid_fil
- }
-
- errno = 0;
-- if ((cnt = xread (fp, buf, BUFSIZ)) < 0) {
-+ cnt = xread(fp, buf, BUFSIZ);
-+ close(fp);
-+ if (cnt < 0) {
- warn("Can not read pid file %s: %s\n", pid_file, strerror(errno));
- return -1;
- }
-- close(fp);
- buf[cnt] = '\0';
-
- bufp = buf;
-@@ -847,10 +855,11 @@ int verify_pidfile (const char * pid_fil
- char ent[3];
- boolean thread;
- ssize_t len;
-+
- len = xread(fp, ent, sizeof(ent));
- close(fp);
-
-- if (!len)
-+ if (len <= 0)
- goto out;
-
- thread = (strncmp(ent, "0 ", 2) == 0);
-@@ -923,7 +932,7 @@ int verify_pidfile (const char * pid_fil
- }
-
- if (!(flags & (KTHREAD|KSHORT))&& isscrpt &&
-- (fp = open(proc(buf, "cmd"), O_PROCMODE)) != -1) {
-+ (fp = open(proc(buf, "cmdline"), O_PROCMODE)) != -1) {
-
- char entry[PATH_MAX+1];
- const char *scrpt = NULL;
-@@ -932,6 +941,9 @@ int verify_pidfile (const char * pid_fil
- len = xread(fp, entry, PATH_MAX);
- close(fp);
-
-+ if (len <= 0)
-+ goto out;
-+
- /* Seek for a script not for a binary */
- if (!(scrpt = checkscripts(entry, root, len, buf)))
- goto out; /* Nothing found */
-@@ -951,7 +963,7 @@ int verify_pidfile (const char * pid_fil
- len = xread(fp, entry, PATH_MAX);
- close(fp);
-
-- if (!len)
-+ if (len <= 0)
- goto out;
-
- comm = index(entry, ' ');
-@@ -1040,7 +1052,7 @@ int check_pids (const char * inname, con
- len = xread(fp, ent, sizeof(ent));
- close(fp);
-
-- if (!len)
-+ if (len <= 0)
- goto ignore; /* Bogus */
-
- thread = (strncmp(ent, "0 ", 2) == 0);
-@@ -1102,7 +1114,7 @@ int check_pids (const char * inname, con
- }
-
- if (!(flags & (KTHREAD|KSHORT)) && isscrpt &&
-- (fp = open(proc(pid, "cmd"), O_PROCMODE)) != -1) {
-+ (fp = open(proc(pid, "cmdline"), O_PROCMODE)) != -1) {
-
- char entry[PATH_MAX+1];
- const char *scrpt;
-@@ -1111,7 +1123,7 @@ int check_pids (const char * inname, con
- len = xread(fp, entry, PATH_MAX);
- close(fp);
-
-- if (!len)
-+ if (len <= 0)
- goto ignore; /* Bogus */
-
- /* Seek for a script not for a binary */
-@@ -1131,7 +1143,7 @@ int check_pids (const char * inname, con
- len = xread(fp, entry, PATH_MAX);
- close(fp);
-
-- if (!len)
-+ if (len <= 0)
- goto ignore; /* Bogus */
-
- comm = index(entry, ' ');
---- libinit.h
-+++ libinit.h 2010-10-04 14:43:56.099926049 +0000
-@@ -93,7 +93,7 @@
- #define NOPIDREAD 101 /* trouble */
-
- #define LSB_STATUS_PROOF ((errno == EPERM) ? LSB_NOPERM : NOPIDREAD )
--#define LSB_STATUS_PROOFX ((errno == ENOENT) ? LSB_NOENTR : LSB_STATUS_PROOF )
-+#define LSB_STATUS_PROOFX ((errno == ENOENT) ? (flags & KILL) ? LSB_NOENTR : 4 : LSB_STATUS_PROOF )
-
- #define LOG_OPTIONS (LOG_ODELAY|LOG_CONS)
- #define LOG_FACILITY LOG_LOCAL7
---- startproc.8
-+++ startproc.8 2009-12-03 17:00:05.739929445 +0000
-@@ -59,9 +59,15 @@ processes are found. Note that
- is designed to start a daemon but not a kernel thread or
- a program which enables a kernel thread.
- .PP
-+Without any option
- .B startproc
--does not use the pid to search for a process but the full
--path of the corresponding program which is used to identify the executable
-+does search for a process by using the full
-+path of the corresponding program and a default pid file
-+.RB (/var/run/ <basename> .pid)
-+which are used together to identify the executable
-+out from the
-+.I /proc
-+file system
- .RB (see " proc" (5)).
- Only if the inode number
- .RB (/proc/ <pid> /exe)
-@@ -81,7 +87,7 @@ changed due to the LSB specification).
- If this option is specified,
- .B startproc
- tries to check against the pid read from this file
--instead of the default
-+instead of the default pid file
- .RB (/var/run/ <basename> .pid).
- The pid read from this file is compared against the pids of possible
- running processes that use the specified executable. In order to avoid
---- startproc.c
-+++ startproc.c 2009-12-07 14:15:44.487929547 +0000
-@@ -41,7 +41,8 @@ static int do_start(const char *name, ch
- static void closefds(FILE *not);
- static void waiton(const char *list);
-
--static int quiet = 1, supprmsg = 0, sess = 0, seconds = 0, sigchld = 0, force = 0, dialog = 0;
-+static int quiet = true, supprmsg = false, sess = false, seconds = false;
-+static int sigchld = false, force = false, dialog = false;
- static struct passwd *user = NULL;
- static struct group *grp = NULL;
- static int syslogd = 0;
-@@ -54,7 +55,7 @@ static void (*save_sigquit) = SIG_DFL;
- static void sig_quit(int nsig)
- {
- (void)signal(nsig, save_sigquit);
-- signaled = 1;
-+ signaled = true;
- }
-
- static void sig_chld(int nsig)
-@@ -113,10 +114,10 @@ int main(int argc, char **argv)
- error(LSB_WRGSYN,"Option -c requires special root directory\n");
- break;
- case 'e':
-- env = 1;
-+ env = true;
- break;
- case 'd':
-- dialog = 1;
-+ dialog = true;
- seconds = 15;
- break;
- case 'p': /* Former option -f */
-@@ -129,7 +130,7 @@ int main(int argc, char **argv)
- error(LSB_WRGSYN,"Option -p requires pid file to read pid from\n");
- break;
- case 'f': /* Newer option -f for force start (LSB specs!) */
-- force++;
-+ force = true;
- break;
- case 'l':
- if (optarg && optarg[0] != '-' && !log_file) {
-@@ -158,11 +159,11 @@ int main(int argc, char **argv)
- error(LSB_WRGSYN,"Option -n requires nice level\n");
- break;
- case 'q':
-- supprmsg = 1;
-+ supprmsg = true;
- break;
- case 's':
- if (sdaemon) goto fail;
-- sess = 1;
-+ sess = true;
- break;
- case 'u':
- if (optarg && optarg[0] != '/' && optarg[0] != '-') {
-@@ -288,7 +289,8 @@ int main(int argc, char **argv)
- pid_file = (char*) xmalloc(DEFPIDLEN+strlen(basename)+1);
- pid_file = strcat(strcat(strcpy(pid_file,DEFPIDDIR),basename),DEFPIDEXT);
- }
-- }
-+ } else
-+ force = true;
-
- /* Check and verify the pid file */
- errno = 0;
-@@ -296,17 +298,25 @@ int main(int argc, char **argv)
- if (errno != ENOENT)
- warn("Can not stat %s: %s\n", pid_file, strerror(errno));
-
-- /* No pid file means that we have to search in /proc/ */
- free(pid_file);
- pid_file = NULL;
-+
-+ if (force && errno == ENOENT)
-+ goto force;
-+
-+ /* No pid file means that we have to search in /proc/ */
- }
-
- if (pid_file && !st.st_size) {
- warn("Empty pid file %s for %s\n", pid_file, fullname);
-
-- /* No pid file means that we have to search in /proc/ */
- free(pid_file);
- pid_file = NULL;
-+
-+ if (force)
-+ goto force;
-+
-+ /* No pid file means that we have to search in /proc/ */
- }
-
- if (pid_file) { /* The case of having a pid file */
-@@ -336,6 +346,8 @@ int main(int argc, char **argv)
-
- /* Do main work */
- if (!remember) { /* No process found with pid file */
-+ if (force)
-+ goto force;
- if (pidof(fullname,root,flags) < 0)
- exit(LSB_PROOFX);
- clear_pids(); /* Remove all pids which should be ignored */
++Just a dummy, remove for a real patch
++++++ killproc-2.16.tar.bz2 -> killproc-2.17.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.16/Makefile new/killproc-2.17/Makefile
--- old/killproc-2.16/Makefile 2009-08-20 14:04:40.000000000 +0200
+++ new/killproc-2.17/Makefile 2010-10-21 11:41:44.000000000 +0200
@@ -12,7 +12,7 @@
PREFIX = /usr
DEBUG =
DESTDIR =
-VERSION = 2.16
+VERSION = 2.17
DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]')
ifneq ($(INC),)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.16/checkproc.8 new/killproc-2.17/checkproc.8
--- old/killproc-2.16/checkproc.8 2009-08-20 14:04:40.000000000 +0200
+++ new/killproc-2.17/checkproc.8 2010-10-21 11:41:45.000000000 +0200
@@ -278,6 +278,8 @@
No process but pid file found
.IP 3 5
No process and no pid file found
+.IP 4 5
+Program is not installed
.RE
.RS 5
.IP 101 7
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.16/checkproc.c new/killproc-2.17/checkproc.c
--- old/killproc-2.16/checkproc.c 2009-08-20 14:04:40.000000000 +0200
+++ new/killproc-2.17/checkproc.c 2010-10-21 11:41:45.000000000 +0200
@@ -92,7 +92,6 @@
/* Allocate here: address optarg (current *argv) isn't freeable */
if (optarg && !pid_file) {
pid_file = xstrdup(optarg);
- pid_forced = true;
} else
error(WRGSYNTAX, "Option -p requires pid file to read pid from\n");
break;
@@ -137,7 +136,8 @@
if (*fullname != '/')
flags |= KSHORT;
else if (check4nfs(fullname))
- flags |= (KSHORT|KBASE);;
+ flags |= (KSHORT|KBASE);
+ clear_nfs();
if (!pid_file) { /* the default pid file */
if (root) {
@@ -148,7 +148,8 @@
pid_file = (char*) xmalloc(DEFPIDLEN+strlen(basename)+1);
pid_file = strcat(strcat(strcpy(pid_file,DEFPIDDIR),basename),DEFPIDEXT);
}
- }
+ } else
+ pid_forced = true;
/* Check and verify the pid file */
errno = 0;
@@ -163,22 +164,27 @@
* the proc is dead if the specified pid can not be veryfied.
*/
if (remember_pids(pid_file,fullname,root,flags) < 0)
- exit(LSB_PROOFX);
+ exit(LSB_STATUS_PROOFX);
if (!remember)
exit(LSB_STATUS_NOPROC); /* New LSB: no pid file is no job */
}
- /* No pid file means that we have to search in /proc/ */
free(pid_file);
pid_file = NULL;
+
+ /* No pid file means that we have to search in /proc/ */
}
if (pid_file && !st.st_size) {
warn("Empty pid file %s for %s\n", pid_file, fullname);
- /* No pid file means that we have to search in /proc/ */
free(pid_file);
pid_file = NULL;
+
+ if (pid_forced)
+ exit(LSB_STATUS_NOPROC);
+
+ /* No pid file means that we have to search in /proc/ */
}
/* Check and verify the ignore file */
@@ -205,6 +211,8 @@
exit(LSB_STATUS_PROOFX);
}
if (!remember) { /* No process found with pid file */
+ if (pid_forced)
+ exit(LSB_STATUS_PROOFX);
if (pidof(fullname,root,flags) < 0)
exit(LSB_STATUS_PROOFX);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.16/killproc-2.16.lsm new/killproc-2.17/killproc-2.16.lsm
--- old/killproc-2.16/killproc-2.16.lsm 2009-08-20 14:04:40.000000000 +0200
+++ new/killproc-2.17/killproc-2.16.lsm 1970-01-01 01:00:00.000000000 +0100
@@ -1,18 +0,0 @@
-Begin3
-Title: killproc and assorted tools for boot scripts
-Version: 2.16
-Entered-date: 20AUG09
-Description: Some useful programs for a replacment of the shell functions
- daemom and killproc found in the Linux System V init suite.
- killproc(8) for signaling or terminating, checkproc(8) for
- checking and startproc(8) for starting processes.
- Each program has its own manual page.
-Keywords: killproc, startproc, checkproc, process control
-Author: Werner Fink
-Maintained-by: Werner Fink
-Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init
- @UNKNOWN killproc-2.16.tar.gz
-Alternate-site: ftp.suse.com /pub/projects/init
-Platforms: Linux with System VR2 or higher boot scheme
-Copying-policy: GPL
-End
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.16/killproc-2.17.lsm new/killproc-2.17/killproc-2.17.lsm
--- old/killproc-2.16/killproc-2.17.lsm 1970-01-01 01:00:00.000000000 +0100
+++ new/killproc-2.17/killproc-2.17.lsm 2010-10-21 11:41:45.000000000 +0200
@@ -0,0 +1,18 @@
+Begin3
+Title: killproc and assorted tools for boot scripts
+Version: 2.17
+Entered-date: 21OCT10
+Description: Some useful programs for a replacment of the shell functions
+ daemom and killproc found in the Linux System V init suite.
+ killproc(8) for signaling or terminating, checkproc(8) for
+ checking and startproc(8) for starting processes.
+ Each program has its own manual page.
+Keywords: killproc, startproc, checkproc, process control
+Author: Werner Fink
+Maintained-by: Werner Fink
+Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init
+ @UNKNOWN killproc-2.17.tar.gz
+Alternate-site: ftp.suse.com /pub/projects/init
+Platforms: Linux with System VR2 or higher boot scheme
+Copying-policy: GPL
+End
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.16/killproc.8 new/killproc-2.17/killproc.8
--- old/killproc-2.16/killproc.8 2009-08-20 14:04:40.000000000 +0200
+++ new/killproc-2.17/killproc.8 2010-10-21 11:41:44.000000000 +0200
@@ -57,9 +57,11 @@
.B killproc
then
.B SIGHUP
-is used. Note that if
+is used. Note that if no signal is specified on the command line and the program
+.B killproc
+can not terminate a process with the default
.B SIGTERM
-is used and does not terminate a process the signal
+the signal
.B SIGKILL
is send after a few seconds (default is 5 seconds, see option
.BR \-t ).
@@ -240,16 +242,21 @@
.B \-t\fI<sec>\fP
The number
.I <sec>
-specifies the seconds to wait between the sent signal
+specifies the seconds to wait between the default signal
.B SIGTERM
and the subsequentially signal
.B SIGKILL
if the first
.B SIGTERM
does not show any result within the
-first few milli seconds. This defaults to
+first few milli seconds. This timeout defaults to
.B 5
-seconds.
+seconds. On the other hand if the signal
+.B SIGTERM
+was explicitly used on the command line, the signal
+.B SIGKILL
+will be omitted, even if the process was not terminated
+after the timeout has expired.
.TP
.B \-q
This option is ignored.
@@ -278,7 +285,7 @@
terminate the sendmail process. Other running processes are
ignored.
.TP
-.B killproc -p /var/myrun/lpd.pid -TERM /usr/sbin/lpd
+.B killproc -p /var/myrun/lpd.pid /usr/sbin/lpd
.IP
sends the signal
.B SIGTERM
@@ -293,7 +300,7 @@
assumes that the daemon of
.B /usr/sbin/lpd
is not running. The exit status
-is set to 0 for successfully delivering the given signals
+is set to 0 for successfully delivering the default signals
.BR SIGTERM " and " SIGKILL
otherwise to 7 if the program was not running. It is also
successful if
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.16/killproc.c new/killproc-2.17/killproc.c
--- old/killproc-2.16/killproc.c 2009-08-20 14:04:40.000000000 +0200
+++ new/killproc-2.17/killproc.c 2010-10-21 11:41:44.000000000 +0200
@@ -48,6 +48,7 @@
int process_group = 0, group_leader = 0, wait = 5, iargc = 0;
unsigned short flags = (KILL|PIDOF|KSTOP);
boolean pid_forced = false;
+ boolean sig_forced = true;
we_are = base_name(argv[0]);
openlog (we_are, LOG_OPTIONS, LOG_FACILITY);
@@ -79,11 +80,13 @@
memset(sig, 0, len);
*sig = 'q'; /* set dummy option -q */
snum = tmp;
+ sig_forced = false;
break;
} else if ( (tmp = signame_to_signum(sig)) > 0 ) {
memset(sig, 0, len);
*sig = 'q'; /* set dummy option -q */
snum = tmp;
+ sig_forced = false;
break;
}
}
@@ -135,7 +138,6 @@
/* Allocate here: address optarg (current *argv) isn't freeable */
if (optarg && !pid_file) {
pid_file = xstrdup(optarg);
- pid_forced = true;
} else
error(LSB_WRGSYN,"Option -p requires pid file to read pid from\n");
break;
@@ -185,6 +187,7 @@
flags |= KSHORT;
else if (check4nfs(fullname))
flags |= (KSHORT|KBASE);
+ clear_nfs();
if (!pid_file) { /* the default pid file */
if (root) {
@@ -195,7 +198,8 @@
pid_file = (char*) xmalloc(DEFPIDLEN+strlen(basename)+1);
pid_file = strcat(strcat(strcpy(pid_file,DEFPIDDIR),basename),DEFPIDEXT);
}
- }
+ } else
+ pid_forced = true;
/* Check and verify the pid file */
errno = 0;
@@ -215,17 +219,22 @@
if (!remember)
exit(LSB_NOPROC); /* New LSB: no pid file is no job */
}
- /* No pid file means that we have to search in /proc/ */
free(pid_file);
pid_file = NULL;
+
+ /* No pid file means that we have to search in /proc/ */
}
if (pid_file && !st.st_size) {
warn("Empty pid file %s for %s\n", pid_file, fullname);
- /* No pid file means that we have to search in /proc/ */
free(pid_file);
pid_file = NULL;
+
+ if (pid_forced)
+ exit(LSB_STATUS_NOPROC);
+
+ /* No pid file means that we have to search in /proc/ */
}
if (pid_file) { /* The case of having a pid file */
@@ -291,7 +300,10 @@
goto again;
}
- if (snum == SIGKILL)
+ if (snum == SIGKILL) /* SIGKILL was specified on the command line */
+ goto badterm;
+
+ if (!sig_forced) /* SIGTERM was specified on the command line */
goto badterm;
if (check_pids(fullname,root,flags) < 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.16/libinit.c new/killproc-2.17/libinit.c
--- old/killproc-2.16/libinit.c 2009-08-20 14:04:40.000000000 +0200
+++ new/killproc-2.17/libinit.c 2010-10-21 11:41:45.000000000 +0200
@@ -218,6 +218,106 @@
{ 0, "EXIT" }
};
+typedef struct _mntinfo_
+{
+ struct _mntinfo_ *next;
+ struct _mntinfo_ *prev;
+ struct _mntinfo_ *parent;
+ int id, parid;
+ dev_t dev;
+ size_t nlen;
+ char * point;
+} MNTINFO;
+
+static MNTINFO *mounts;
+
+static void init_mounts(void)
+{
+ char point[PATH_MAX+1];
+ int mid, parid, max = 0;
+ uint maj, min;
+ MNTINFO *save;
+ FILE * mnt;
+
+ if (mounts)
+ return;
+ if ((mnt = fopen("/proc/self/mountinfo", "r")) == (FILE*)0)
+ return;
+ while (fscanf(mnt, "%i %i %u:%u %*s %s %*[^\n]", &mid, &parid, &maj, &min, &point[0]) == 5) {
+ const size_t nlen = strlen(point);
+ MNTINFO *restrict p;
+ if (posix_memalign((void*)&p, sizeof(void*), alignof(MNTINFO)+(nlen+1)) != 0) {
+ if (stopped) kill(-1, SIGCONT);
+ error(100, "malloc(): %s\n", strerror(errno));
+ }
+ p->point = ((char*)p)+alignof(MNTINFO);
+ strcpy(p->point, point);
+ p->nlen = nlen;
+ p->parid = parid;
+ p->dev = makedev(maj, min);
+ p->id = mid;
+ if (mounts)
+ mounts->prev = p;
+ p->next = mounts;
+ p->prev = (MNTINFO*)0;
+ p->parent = p;
+ mounts = p;
+ if (mid > max)
+ max = mid;
+ }
+ fclose(mnt);
+
+ /* Sort mount points accordingly to the reverse mount order */
+ save = (MNTINFO*)0;
+ for (mid = 1; mid <= max; mid++) {
+ MNTINFO *m, *n, *l;
+ n = mounts;
+ l = (MNTINFO*)0;
+ for (m = mounts; n; m = n) {
+ n = m->next;
+ if (m->id != mid)
+ continue;
+ l = m->prev;
+ if (m == mounts) {
+ if (n) n->prev = (MNTINFO*)0;
+ mounts = n;
+ } else if (l) {
+ if (n) n->prev = l;
+ l->next = n;
+ }
+ if (save)
+ save->prev = m;
+ m->next = save;
+ m->prev = (MNTINFO*)0;
+ save = m;
+ break;
+ }
+ }
+ mounts = save;
+
+ /* Now determine the parent of each mount point */
+ for (save = mounts; save; save = save->next) {
+ MNTINFO *p;
+ for (p = mounts; p; p = p->next) {
+ if (save->parid != p->id)
+ continue;
+ save->parent = p;
+ break;
+ }
+ }
+}
+
+static MNTINFO *find_mount(const char * path)
+{
+ MNTINFO *m;
+ for (m = mounts; m; m = m->next) {
+ if (strncmp(path, m->point, m->nlen))
+ continue;
+ break;
+ }
+ return m;
+}
+
extern inline char * handl_buf(char *restrict buf)
{
char * ptr = strstr(buf, " (deleted)");
@@ -320,13 +420,15 @@
while (1) {
errno = 0;
bytes = read(fd, inbuf, count);
- if (bytes < 0 && (errno == EINTR || errno == EAGAIN))
- continue;
- if (bytes < 0)
+ if (bytes < 0) {
+ if (errno == EINTR || errno == EAGAIN)
+ continue;
+ if (errno == ESRCH)
+ goto out;
break;
+ }
goto out;
}
-
warn("xread error: %s\n", strerror(errno));
out:
errno = olderr;
@@ -446,9 +548,9 @@
goto out;
if ((fp = open(proc(pid, "stat"), O_PROCMODE)) != -1) {
- xread(fp, buf, BUFSIZ);
+ ssize_t len = xread(fp, buf, BUFSIZ);
close(fp);
- if (sscanf(buf,"%*d %*s %*c %d %*d %*d", &pppid) != 1)
+ if (len <= 0 || sscanf(buf,"%*d %*s %*c %d %*d %*d", &pppid) != 1)
warn("can not read ppid for process %d!\n", ppid);
}
out:
@@ -525,6 +627,7 @@
pid_t pid;
char *swapname = NULL;
char *fullname = (char *)inname;
+ MNTINFO *prefix = NULL;
PROC *p, *n;
p_pid = getpid();
@@ -549,12 +652,20 @@
* real program is handled, skip this if we handle a kernel thread */
if (!(flags & (KTHREAD|KSHORT))) {
+ MNTINFO *m;
errno = 0;
if (rlstat(&fullname, &full_st, flags) < 0) {
/* stat() follows soft links -> security */
warn("cannot stat %s: %s\n", fullname, strerror(errno));
return -1;
}
+ init_mounts();
+ for (m = mounts; m; m = m->next) {
+ if (m->dev != full_st.st_dev)
+ continue;
+ prefix = m;
+ break;
+ }
}
if (flags & (KTHREAD|KSHORT)) {
@@ -588,16 +699,17 @@
/* Check for kernel threads, zombies or programs */
if ((fp = openat(dfd, here(d->d_name, "statm"), O_PROCMODE)) != -1) {
- char ent[3];
+ char entry[3];
boolean thread;
ssize_t len;
- len = xread(fp,ent,3);
+
+ len = xread(fp,entry,3);
close(fp);
- if (!len)
+ if (len <= 0)
continue;
- thread = (strncmp(ent, "0 ", 2) == 0);
+ thread = (strncmp(entry, "0 ", 2) == 0);
if ((flags & KTHREAD) && !thread)
continue; /* Threads do not have any memory size in user space */
@@ -613,14 +725,29 @@
* 2.2 and above do not lost the link name even if the original
* file is deleted. The link is marked as deleted.
*/
- if (!(flags & (KTHREAD|KSHORT)) && !isscrpt &&
- (fstatat(dfd, here(d->d_name, "exe"), &pid_st, 0) == 0)) {
-
+ if (!(flags & (KTHREAD|KSHORT)) && !isscrpt) {
char entry[PATH_MAX+1];
+ char *realname = NULL;
const char *name;
- char *realname;
boolean found;
+ if ((rll = readlinkat(dfd, here(d->d_name, "exe"), entry, PATH_MAX)) < 0) {
+ if (errno != EPERM && errno != EACCES)
+ goto risky;
+ continue;
+ }
+ entry[rll] = '\0';
+ name = handl_buf(entry);
+
+ if (prefix && find_mount(name) != prefix)
+ continue;
+
+ if (fstatat(dfd, here(d->d_name, "exe"), &pid_st, 0) < 0) {
+ if (errno != EPERM && errno != EACCES)
+ goto risky;
+ continue;
+ }
+
if (pid_st.st_dev != full_st.st_dev)
continue; /* No processes below (kernel 2.2 and up) */
@@ -638,17 +765,12 @@
if (strlen(fullname) > PATH_MAX)
continue;
- if ((rll = readlinkat(dfd, here(d->d_name, "exe"), entry, PATH_MAX)) < 0)
- continue;
- entry[rll] = '\0';
- name = handl_buf(entry);
-
if (strncmp(fullname, name, PATH_MAX) == 0) {
found = true;
break;
}
- if ((realname = realpath(fullname, NULL)) == (char*)0)
+ if ((realname = realpath(name, NULL)) == (char*)0)
continue;
if (strncmp(realname, name, PATH_MAX) == 0)
@@ -673,7 +795,7 @@
* do not hold a file descriptor opened on the script file.
*/
if (!(flags & (KTHREAD|KSHORT)) && isscrpt &&
- (fp = openat(dfd, here(d->d_name, "cmd"), O_PROCMODE)) != -1) {
+ (fp = openat(dfd, here(d->d_name, "cmdline"), O_PROCMODE)) != -1) {
char entry[PATH_MAX+1];
const char *scrpt = NULL;
@@ -682,6 +804,9 @@
len = xread(fp, entry, PATH_MAX);
close(fp);
+ if (len <= 0)
+ continue;
+
/* Seek for a script not for a binary */
if (!(scrpt = checkscripts(entry, root, len, d->d_name)))
continue;
@@ -698,6 +823,7 @@
}
}
+ risky:
/*
* High risk ... the name in stat isn't exact enough to identify
* a swapped out script process, because only the name without
@@ -713,7 +839,7 @@
len = xread(fp, entry, PATH_MAX);
close(fp);
- if (!len)
+ if (len <= 0)
continue;
comm = index(entry, ' ');
@@ -764,7 +890,8 @@
const char * root, unsigned short flags,
const boolean ignore)
{
- int fp, cnt;
+ int fp;
+ ssize_t cnt;
boolean isscrpt = false;
pid_t pid;
char *swapname = NULL, *bufp;
@@ -789,11 +916,12 @@
}
errno = 0;
- if ((cnt = xread (fp, buf, BUFSIZ)) < 0) {
+ cnt = xread(fp, buf, BUFSIZ);
+ close(fp);
+ if (cnt < 0) {
warn("Can not read pid file %s: %s\n", pid_file, strerror(errno));
return -1;
}
- close(fp);
buf[cnt] = '\0';
bufp = buf;
@@ -847,10 +975,11 @@
char ent[3];
boolean thread;
ssize_t len;
+
len = xread(fp, ent, sizeof(ent));
close(fp);
- if (!len)
+ if (len <= 0)
goto out;
thread = (strncmp(ent, "0 ", 2) == 0);
@@ -923,7 +1052,7 @@
}
if (!(flags & (KTHREAD|KSHORT))&& isscrpt &&
- (fp = open(proc(buf, "cmd"), O_PROCMODE)) != -1) {
+ (fp = open(proc(buf, "cmdline"), O_PROCMODE)) != -1) {
char entry[PATH_MAX+1];
const char *scrpt = NULL;
@@ -932,6 +1061,9 @@
len = xread(fp, entry, PATH_MAX);
close(fp);
+ if (len <= 0)
+ goto out;
+
/* Seek for a script not for a binary */
if (!(scrpt = checkscripts(entry, root, len, buf)))
goto out; /* Nothing found */
@@ -951,7 +1083,7 @@
len = xread(fp, entry, PATH_MAX);
close(fp);
- if (!len)
+ if (len <= 0)
goto out;
comm = index(entry, ' ');
@@ -1040,7 +1172,7 @@
len = xread(fp, ent, sizeof(ent));
close(fp);
- if (!len)
+ if (len <= 0)
goto ignore; /* Bogus */
thread = (strncmp(ent, "0 ", 2) == 0);
@@ -1102,7 +1234,7 @@
}
if (!(flags & (KTHREAD|KSHORT)) && isscrpt &&
- (fp = open(proc(pid, "cmd"), O_PROCMODE)) != -1) {
+ (fp = open(proc(pid, "cmdline"), O_PROCMODE)) != -1) {
char entry[PATH_MAX+1];
const char *scrpt;
@@ -1111,7 +1243,7 @@
len = xread(fp, entry, PATH_MAX);
close(fp);
- if (!len)
+ if (len <= 0)
goto ignore; /* Bogus */
/* Seek for a script not for a binary */
@@ -1131,7 +1263,7 @@
len = xread(fp, entry, PATH_MAX);
close(fp);
- if (!len)
+ if (len <= 0)
goto ignore; /* Bogus */
comm = index(entry, ' ');
@@ -1456,12 +1588,21 @@
* corresponding NFS servers are not online.
*/
+typedef struct _shadow_
+{
+ struct _shadow_ *next;
+ struct _shadow_ *prev;
+ size_t nlen;
+ char * name;
+} SHADOW;
+
typedef struct _nfs_
{
struct _nfs_ *next; /* Pointer to next struct. */
struct _nfs_ *prev; /* Pointer to previous st. */
- char * name;
+ SHADOW *shadow; /* Pointer to shadows */
size_t nlen;
+ char * name;
} NFS;
NFS * nfs = (NFS*)0;
@@ -1499,9 +1640,9 @@
error(100, "malloc(): %s\n", strerror(errno));
}
p->name = ((char*)p)+alignof(NFS);
-
strcpy(p->name, ent->mnt_dir);
- p->nlen = strlen(p->name);
+ p->nlen = nlen;
+ p->shadow = (SHADOW*)0;
if (nfs)
nfs->prev = p;
p->next = nfs;
@@ -1509,10 +1650,59 @@
nfs = p;
}
}
+ endmntent(mnt);
+
+ if ((mnt = setmntent("/proc/mounts", "r")) == (FILE*)0)
+ return;
+
+ while ((ent = getmntent(mnt))) {
+ NFS *p;
+
+ for (p = nfs; p; p = p->next) {
+ SHADOW * restrict s;
+ size_t nlen;
+ if (strcmp(ent->mnt_dir, p->name) == 0)
+ continue;
+ if (strncmp(ent->mnt_dir, p->name, p->nlen) != 0)
+ continue;
+
+ nlen = strlen(ent->mnt_dir);
+ if (posix_memalign((void*)&s, sizeof(void*), alignof(SHADOW)+(nlen+1))) {
+ if (stopped) kill(-1, SIGCONT);
+ error(100, "malloc(): %s\n", strerror(errno));
+ }
+ s->name = ((char*)s)+alignof(SHADOW);
+ strcpy(s->name, ent->mnt_dir);
+ s->nlen = nlen;
+ if (p->shadow)
+ p->shadow->prev = s;
+ s->next = p->shadow;
+ s->prev = (SHADOW*)0;
+ p->shadow = s;
+ }
+ }
endmntent(mnt);
}
+static inline boolean shadow(SHADOW *restrict this, const char *restrict name, const size_t nlen)
+{
+ SHADOW *s;
+
+ if (!this)
+ goto out;
+ for (s = this; s; s = s->next) {
+ if (nlen < s->nlen)
+ continue;
+ if (name[s->nlen] != '\0' && name[s->nlen] != '/')
+ continue;
+ if (strncmp(name, s->name, s->nlen) == 0)
+ return true;
+ }
+out:
+ return false;
+}
+
boolean check4nfs(const char * path)
{
char buf[PATH_MAX+1];
@@ -1551,23 +1741,70 @@
if (deep-- <= 0) {
errno = ELOOP;
- return true;
+ return false;
}
} while (true);
if (errno == EINVAL) {
- NFS *p, *n, *l;
- n = nfs;
- l = (NFS*)0;
- for (p = nfs; n; p = n) {
- l = p->prev;
- n = p->next;
- if (!strncmp(curr, p->name, p->nlen))
+ const size_t nlen = strlen(curr);
+ NFS *p;
+ for (p = nfs; p; p = p->next) {
+ if (nlen < p->nlen)
+ continue;
+ if (curr[p->nlen] != '\0' && curr[p->nlen] != '/')
+ continue;
+ if (!strncmp(curr, p->name, p->nlen)) {
+ if (shadow(p->shadow, curr, nlen))
+ continue;
return true;
+ }
}
}
out:
return false;
}
+
+static inline void clear_shadow(SHADOW *restrict shadow)
+{
+ SHADOW *s, *n, *l;
+
+ n = shadow;
+ l = (SHADOW*)0;
+ for (s = shadow; n; s = n) {
+ l = s->prev;
+ n = s->next;
+ if (s == shadow) {
+ if (n) n->prev = (SHADOW*)0;
+ shadow = n;
+ } else if (l) {
+ if (n) n->prev = l;
+ l->next = n;
+ }
+ free(s);
+ }
+}
+
+void clear_nfs(void)
+{
+ NFS *p, *n, *l;
+
+ n = nfs;
+ l = (NFS*)0;
+ for (p = nfs; n; p = n) {
+ l = p->prev;
+ n = p->next;
+ if (p == nfs) {
+ if (n) n->prev = (NFS*)0;
+ nfs = n;
+ } else if (l) {
+ if (n) n->prev = l;
+ l->next = n;
+ }
+ if (p->shadow)
+ clear_shadow(p->shadow);
+ free(p);
+ }
+}
+
/* libinit.c ends here */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.16/libinit.h new/killproc-2.17/libinit.h
--- old/killproc-2.16/libinit.h 2009-08-20 14:04:40.000000000 +0200
+++ new/killproc-2.17/libinit.h 2010-10-21 11:41:45.000000000 +0200
@@ -92,8 +92,8 @@
#define WRGSYNTAX 102 /* usage etc. */
#define NOPIDREAD 101 /* trouble */
-#define LSB_STATUS_PROOF ((errno == EPERM) ? LSB_NOPERM : NOPIDREAD )
-#define LSB_STATUS_PROOFX ((errno == ENOENT) ? LSB_NOENTR : LSB_STATUS_PROOF )
+#define LSB_STATUS_PROOF ((errno == EPERM || errno == EACCES) ? LSB_NOPERM : NOPIDREAD )
+#define LSB_STATUS_PROOFX ((errno == ENOENT) ? (flags & KILL) ? LSB_NOENTR : 4 : LSB_STATUS_PROOF )
#define LOG_OPTIONS (LOG_ODELAY|LOG_CONS)
#define LOG_FACILITY LOG_LOCAL7
@@ -140,8 +140,9 @@
extern void warn(const char *fmt, ...);
extern int rlstat(char ** file, struct stat *st, const unsigned short flag);
extern void init_nfs(void);
+extern void clear_nfs(void);
extern void getproc(void);
-boolean check4nfs(const char * path);
+extern boolean check4nfs(const char * path);
/* Feature */
extern int signame_to_signum (const char *sig);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.16/startproc.8 new/killproc-2.17/startproc.8
--- old/killproc-2.16/startproc.8 2009-08-20 14:04:40.000000000 +0200
+++ new/killproc-2.17/startproc.8 2010-10-21 11:41:45.000000000 +0200
@@ -59,9 +59,15 @@
is designed to start a daemon but not a kernel thread or
a program which enables a kernel thread.
.PP
+Without any option
.B startproc
-does not use the pid to search for a process but the full
-path of the corresponding program which is used to identify the executable
+does search for a process by using the full
+path of the corresponding program and a default pid file
+.RB (/var/run/ <basename> .pid)
+which are used together to identify the executable
+out from the
+.I /proc
+file system
.RB (see " proc" (5)).
Only if the inode number
.RB (/proc/ <pid> /exe)
@@ -81,7 +87,7 @@
If this option is specified,
.B startproc
tries to check against the pid read from this file
-instead of the default
+instead of the default pid file
.RB (/var/run/ <basename> .pid).
The pid read from this file is compared against the pids of possible
running processes that use the specified executable. In order to avoid
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/killproc-2.16/startproc.c new/killproc-2.17/startproc.c
--- old/killproc-2.16/startproc.c 2009-08-20 14:04:40.000000000 +0200
+++ new/killproc-2.17/startproc.c 2010-10-21 11:41:44.000000000 +0200
@@ -41,7 +41,8 @@
static void closefds(FILE *not);
static void waiton(const char *list);
-static int quiet = 1, supprmsg = 0, sess = 0, seconds = 0, sigchld = 0, force = 0, dialog = 0;
+static int quiet = true, supprmsg = false, sess = false, seconds = false;
+static int sigchld = false, force = false, dialog = false;
static struct passwd *user = NULL;
static struct group *grp = NULL;
static int syslogd = 0;
@@ -54,7 +55,7 @@
static void sig_quit(int nsig)
{
(void)signal(nsig, save_sigquit);
- signaled = 1;
+ signaled = true;
}
static void sig_chld(int nsig)
@@ -113,10 +114,10 @@
error(LSB_WRGSYN,"Option -c requires special root directory\n");
break;
case 'e':
- env = 1;
+ env = true;
break;
case 'd':
- dialog = 1;
+ dialog = true;
seconds = 15;
break;
case 'p': /* Former option -f */
@@ -129,7 +130,7 @@
error(LSB_WRGSYN,"Option -p requires pid file to read pid from\n");
break;
case 'f': /* Newer option -f for force start (LSB specs!) */
- force++;
+ force = true;
break;
case 'l':
if (optarg && optarg[0] != '-' && !log_file) {
@@ -158,11 +159,11 @@
error(LSB_WRGSYN,"Option -n requires nice level\n");
break;
case 'q':
- supprmsg = 1;
+ supprmsg = true;
break;
case 's':
if (sdaemon) goto fail;
- sess = 1;
+ sess = true;
break;
case 'u':
if (optarg && optarg[0] != '/' && optarg[0] != '-') {
@@ -288,7 +289,8 @@
pid_file = (char*) xmalloc(DEFPIDLEN+strlen(basename)+1);
pid_file = strcat(strcat(strcpy(pid_file,DEFPIDDIR),basename),DEFPIDEXT);
}
- }
+ } else
+ force = true;
/* Check and verify the pid file */
errno = 0;
@@ -296,17 +298,25 @@
if (errno != ENOENT)
warn("Can not stat %s: %s\n", pid_file, strerror(errno));
- /* No pid file means that we have to search in /proc/ */
free(pid_file);
pid_file = NULL;
+
+ if (force && errno == ENOENT)
+ goto force;
+
+ /* No pid file means that we have to search in /proc/ */
}
if (pid_file && !st.st_size) {
warn("Empty pid file %s for %s\n", pid_file, fullname);
- /* No pid file means that we have to search in /proc/ */
free(pid_file);
pid_file = NULL;
+
+ if (force)
+ goto force;
+
+ /* No pid file means that we have to search in /proc/ */
}
if (pid_file) { /* The case of having a pid file */
@@ -336,6 +346,8 @@
/* Do main work */
if (!remember) { /* No process found with pid file */
+ if (force)
+ goto force;
if (pidof(fullname,root,flags) < 0)
exit(LSB_PROOFX);
clear_pids(); /* Remove all pids which should be ignored */
@@ -432,7 +444,7 @@
if (root) {
if (chroot(root) < 0) {
int lsb = LSB_WRGSYN;
- if (errno == EPERM)
+ if (errno == EPERM || errno == EACCES)
lsb = LSB_NOPERM;
error(lsb,"Can not change root directory to %s: %s\n", optarg, strerror(errno));
}
++++++ showconsole-1.12.dif -> showconsole-1.13.dif ++++++
--- sysvinit/showconsole-1.12.dif 2010-10-12 18:22:55.000000000 +0200
+++ /mounts/work_src_done/STABLE/sysvinit/showconsole-1.13.dif 2010-10-21 12:16:18.000000000 +0200
@@ -1,109 +1,4 @@
---- blogd.c
-+++ blogd.c 2010-09-30 13:12:50.172426395 +0000
-@@ -193,35 +193,16 @@ static void reconnect(int fd)
- if (c->fd != fd) continue;
-
- switch (c->fd) {
-- case 1: /* Standard out */
-- case 2: /* Standard error */
--
-- if ((newfd = open(c->tty, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0)
-- error("can not open %s: %s\n", c->tty, strerror(errno));
--
-- if (newfd != 1)
-- dup2(newfd, 1);
-- if (newfd != 2)
-- dup2(newfd, 2);
-- if (newfd > 2)
-- close(newfd);
--
-+ case 0:
-+ case -1: /* Weired */
- break;
--
-- default: /* IO of further consoles */
--
-+ default: /* IO of system consoles */
- if ((newfd = open(c->tty, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0)
- error("can not open %s: %s\n", c->tty, strerror(errno));
--
-- if (newfd != c->fd) {
-- dup2(newfd, c->fd);
-+ dup2(newfd, c->fd);
-+ if (newfd != c->fd)
- close(newfd);
-- }
--
-- case 0:
-- case -1: /* Weired */
--
-- break;
-+ break;
- }
- }
- }
-@@ -418,10 +399,11 @@ int main(int argc, char *argv[])
- err:
- for (c = cons; c; c = c->next) {
- if (c->fd > 0) {
-- if (c->tlock > 1) /* write back lock if any */
-- (void)ioctl(c->fd, TIOCSLCKTRMIOS, &c->ltio);
- if (c->tlock) /* write back old setup */
- tcsetattr(c->fd, TCSANOW, &c->otio);
-+ if (c->tlock > 1) /* write back lock if any */
-+ (void)ioctl(c->fd, TIOCSLCKTRMIOS, &c->ltio);
-+ c->tlock = 0;
- close(c->fd);
- c->fd = -1;
- }
---- libblogger.c
-+++ libblogger.c 2010-10-12 16:12:20.743926028 +0000
-@@ -54,7 +54,7 @@ static int bootlog_init(const int lvl __
- if (!S_ISFIFO(st.st_mode))
- goto out;
-
-- if ((fdfifo = open(fifo_name, O_WRONLY|O_NONBLOCK)) < 0)
-+ if ((fdfifo = open(fifo_name, O_WRONLY|O_NONBLOCK|O_NOCTTY|O_CLOEXEC)) < 0)
- goto out;
-
- ret = 0;
---- libconsole.c
-+++ libconsole.c 2010-10-12 16:20:05.187926537 +0000
-@@ -770,7 +770,7 @@ void prepareIO(void (*rfunc)(int), void
- (void)mkfifo(fifo_name, 0600);
- errno = 0;
- if (!stat(fifo_name, &st) && S_ISFIFO(st.st_mode)) {
-- if ((fdfifo = open(fifo_name, O_RDWR|O_NOCTTY)) < 0)
-+ if ((fdfifo = open(fifo_name, O_RDONLY|O_NOCTTY|O_CLOEXEC)) < 0)
- warn("can not open named fifo %s: %s\n", fifo_name, strerror(errno));
- }
- }
-@@ -788,7 +788,7 @@ static void more_input (struct timeval *
- FD_ZERO (&watch);
- FD_SET (fdread, &watch);
-
-- if (fdfifo > 0) {
-+ if (fdfifo >= 0) {
- FD_SET (fdfifo, &watch);
- wfds = (fdread > fdfifo ? fdread : fdfifo) + 1;
- } else
-@@ -836,7 +836,7 @@ static void more_input (struct timeval *
- }
- }
-
-- if (fdfifo > 0 && FD_ISSET(fdfifo, &watch)) {
-+ if (fdfifo >= 0 && FD_ISSET(fdfifo, &watch)) {
- const ssize_t cnt = safein(fdfifo, (char*)trans, sizeof(trans), noerr);
-
- if (cnt > 0) {
-@@ -1003,6 +1003,10 @@ void closeIO(void)
- (void)fclose(flog);
- flog = NULL;
- xout:
-+ if (fdfifo >= 0) {
-+ close(fdfifo);
-+ fdfifo = -1;
-+ }
- for (c = cons; c; c = c->next) {
- if (c->fd < 0)
- continue;
+--- .dummy
++++ .dummy 2010-10-21 09:54:55.000000000 +0000
+@@ -0,0 +1 @@
++Just a dummy, remove for a real patch
++++++ showconsole-1.12.tar.bz2 -> showconsole-1.13.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.12/Makefile new/showconsole-1.13/Makefile
--- old/showconsole-1.12/Makefile 2010-08-24 18:38:32.000000000 +0200
+++ new/showconsole-1.13/Makefile 2010-10-21 11:57:34.000000000 +0200
@@ -13,7 +13,7 @@
#DESTDIR = /tmp/root
DEBUG =
DESTDIR =
-VERSION = 1.12
+VERSION = 1.13
DATE = $(shell date +'%d%b%y' | tr '[:lower:]' '[:upper:]')
COPTS =
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.12/blogd.c new/showconsole-1.13/blogd.c
--- old/showconsole-1.12/blogd.c 2010-09-24 15:16:22.000000000 +0200
+++ new/showconsole-1.13/blogd.c 2010-10-21 11:57:05.000000000 +0200
@@ -193,35 +193,16 @@
if (c->fd != fd) continue;
switch (c->fd) {
- case 1: /* Standard out */
- case 2: /* Standard error */
-
- if ((newfd = open(c->tty, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0)
- error("can not open %s: %s\n", c->tty, strerror(errno));
-
- if (newfd != 1)
- dup2(newfd, 1);
- if (newfd != 2)
- dup2(newfd, 2);
- if (newfd > 2)
- close(newfd);
-
+ case 0:
+ case -1: /* Weired */
break;
-
- default: /* IO of further consoles */
-
+ default: /* IO of system consoles */
if ((newfd = open(c->tty, O_WRONLY|O_NONBLOCK|O_NOCTTY)) < 0)
error("can not open %s: %s\n", c->tty, strerror(errno));
-
- if (newfd != c->fd) {
- dup2(newfd, c->fd);
+ dup2(newfd, c->fd);
+ if (newfd != c->fd)
close(newfd);
- }
-
- case 0:
- case -1: /* Weired */
-
- break;
+ break;
}
}
}
@@ -418,10 +399,11 @@
err:
for (c = cons; c; c = c->next) {
if (c->fd > 0) {
- if (c->tlock > 1) /* write back lock if any */
- (void)ioctl(c->fd, TIOCSLCKTRMIOS, &c->ltio);
if (c->tlock) /* write back old setup */
tcsetattr(c->fd, TCSANOW, &c->otio);
+ if (c->tlock > 1) /* write back lock if any */
+ (void)ioctl(c->fd, TIOCSLCKTRMIOS, &c->ltio);
+ c->tlock = 0;
close(c->fd);
c->fd = -1;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.12/libblogger.c new/showconsole-1.13/libblogger.c
--- old/showconsole-1.12/libblogger.c 2010-08-24 13:10:05.000000000 +0200
+++ new/showconsole-1.13/libblogger.c 2010-10-21 11:57:05.000000000 +0200
@@ -54,7 +54,7 @@
if (!S_ISFIFO(st.st_mode))
goto out;
- if ((fdfifo = open(fifo_name, O_WRONLY|O_NONBLOCK)) < 0)
+ if ((fdfifo = open(fifo_name, O_WRONLY|O_NONBLOCK|O_NOCTTY|O_CLOEXEC)) < 0)
goto out;
ret = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.12/libconsole.c new/showconsole-1.13/libconsole.c
--- old/showconsole-1.12/libconsole.c 2010-09-23 11:50:59.000000000 +0200
+++ new/showconsole-1.13/libconsole.c 2010-10-21 11:57:05.000000000 +0200
@@ -770,7 +770,7 @@
(void)mkfifo(fifo_name, 0600);
errno = 0;
if (!stat(fifo_name, &st) && S_ISFIFO(st.st_mode)) {
- if ((fdfifo = open(fifo_name, O_RDWR|O_NOCTTY)) < 0)
+ if ((fdfifo = open(fifo_name, O_RDONLY|O_NOCTTY|O_CLOEXEC)) < 0)
warn("can not open named fifo %s: %s\n", fifo_name, strerror(errno));
}
}
@@ -788,7 +788,7 @@
FD_ZERO (&watch);
FD_SET (fdread, &watch);
- if (fdfifo > 0) {
+ if (fdfifo >= 0) {
FD_SET (fdfifo, &watch);
wfds = (fdread > fdfifo ? fdread : fdfifo) + 1;
} else
@@ -836,7 +836,7 @@
}
}
- if (fdfifo > 0 && FD_ISSET(fdfifo, &watch)) {
+ if (fdfifo >= 0 && FD_ISSET(fdfifo, &watch)) {
const ssize_t cnt = safein(fdfifo, (char*)trans, sizeof(trans), noerr);
if (cnt > 0) {
@@ -1003,6 +1003,10 @@
(void)fclose(flog);
flog = NULL;
xout:
+ if (fdfifo >= 0) {
+ close(fdfifo);
+ fdfifo = -1;
+ }
for (c = cons; c; c = c->next) {
if (c->fd < 0)
continue;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.12/showconsole-1.12.lsm new/showconsole-1.13/showconsole-1.12.lsm
--- old/showconsole-1.12/showconsole-1.12.lsm 2010-09-24 18:01:01.000000000 +0200
+++ new/showconsole-1.13/showconsole-1.12.lsm 1970-01-01 01:00:00.000000000 +0100
@@ -1,15 +0,0 @@
-Begin3
-Title: console tools for boot scripts
-Version: 1.12
-Entered-date: 24SEP10
-Description: Used for fetch the real device in boot scripts
- running on /dev/console.
-Keywords: boot control
-Author: Werner Fink
-Maintained-by: Werner Fink
-Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init
- @UNKNOWN showconsole-1.12.tar.gz
-Alternate-site: ftp.suse.com /pub/projects/init
-Platforms: Linux with System VR2 or higher boot scheme
-Copying-policy: GPL
-End
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/showconsole-1.12/showconsole-1.13.lsm new/showconsole-1.13/showconsole-1.13.lsm
--- old/showconsole-1.12/showconsole-1.13.lsm 1970-01-01 01:00:00.000000000 +0100
+++ new/showconsole-1.13/showconsole-1.13.lsm 2010-10-21 11:57:37.000000000 +0200
@@ -0,0 +1,15 @@
+Begin3
+Title: console tools for boot scripts
+Version: 1.13
+Entered-date: 21OCT10
+Description: Used for fetch the real device in boot scripts
+ running on /dev/console.
+Keywords: boot control
+Author: Werner Fink
+Maintained-by: Werner Fink
+Primary-site: sunsite.unc.edu /pub/Linux/system/daemons/init
+ @UNKNOWN showconsole-1.13.tar.gz
+Alternate-site: ftp.suse.com /pub/projects/init
+Platforms: Linux with System VR2 or higher boot scheme
+Copying-policy: GPL
+End
++++++ sysvinit-2.88dsf-nfs.patch ++++++
--- src/killall5.c
+++ src/killall5.c 2010-10-21 09:51:07.771926189 +0000
@@ -112,8 +112,8 @@ typedef struct _s_nfs
struct _s_nfs *next; /* Pointer to next struct. */
struct _s_nfs *prev; /* Pointer to previous st. */
SHADOW *shadow; /* Pointer to shadows */
- char * name;
size_t nlen;
+ char * name;
} NFS;
/* List of processes. */
@@ -346,7 +346,7 @@ static void clear_mnt(void)
}
/*
- * Check if path is ia shadow off a NFS partition.
+ * Check if path is a shadow of a NFS partition.
*/
static int shadow(SHADOW *restrict this, const char *restrict name, const size_t nlen)
{
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org