OBS User autobuild 2009-10-03 00:28:41 +00:00 committed by Git OBS Bridge
parent f690d3fe3f
commit 19b887d79b
2 changed files with 4 additions and 136 deletions

View File

@ -1,130 +1,4 @@
--- libinit.c --- .dummy
+++ libinit.c 2009-09-29 10:42:09.875428620 +0200 +++ .dummy 2009-08-19 12:18:39.181901099 +0200
@@ -446,9 +446,9 @@ static pid_t getpppid(const pid_t ppid) @@ -0,0 +1 @@
goto out; +this is a dummy, remove if real changes are required
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 +591,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);
@@ -682,6 +683,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 +717,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 +768,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 +794,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 +853,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);
@@ -932,6 +939,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 +961,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 +1050,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);
@@ -1111,7 +1121,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 +1141,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, ' ');

View File

@ -1,9 +1,3 @@
-------------------------------------------------------------------
Tue Sep 29 10:48:03 CEST 2009 - werner@suse.de
- Make killproc utils more stable in case that during read(2) a proc
file the corresponding process has already terminated (bnc#542717)
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Aug 20 14:17:32 CEST 2009 - werner@suse.de Thu Aug 20 14:17:32 CEST 2009 - werner@suse.de