]> granicus.if.org Git - procps-ng/commitdiff
pgrep/pkill -F expects \n (Debian Bug report #676709)
authorAlfredo Esteban <aedelatorre@gmail.com>
Sat, 7 Jul 2012 01:15:15 +0000 (03:15 +0200)
committerCraig Small <csmall@enc.com.au>
Sat, 14 Jul 2012 05:55:45 +0000 (15:55 +1000)
Hi,

I'm sending the patch to fix Debian bug report #676709:

pgrep/pkill -F expects "\n". If not present, no process is found/killed:

> wc -l /run/atd.pid
1 /run/atd.pid

> pgrep -F /run/atd.pid
1213

> wc -l /run/NetworkManager.pid
0 /run/NetworkManager.pid

> pgrep -F /run/NetworkManager.pid

Alfredo

pgrep.c

diff --git a/pgrep.c b/pgrep.c
index 3a4b34512e54f8876fa2dadad3969af39f95f608..84f955f911f5df1d698f11aaa5376acafd60d9b1 100644 (file)
--- a/pgrep.c
+++ b/pgrep.c
@@ -241,7 +241,6 @@ static struct el *read_pidfile(void)
        n = read(fd,buf+1,sizeof buf-2);
        if (n<1)
                goto out;
-       buf[n] = '\0';
        pid = strtoul(buf+1,&endp,10);
        if(endp<=buf+1 || pid<1 || pid>0x7fffffff)
                goto out;