From: Alfredo Esteban Date: Sat, 7 Jul 2012 01:15:15 +0000 (+0200) Subject: pgrep/pkill -F expects \n (Debian Bug report #676709) X-Git-Tag: v3.3.4~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7696bd200e6062f6c15b7922ebfbfc81fcbcb18c;p=procps-ng pgrep/pkill -F expects \n (Debian Bug report #676709) 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 --- diff --git a/pgrep.c b/pgrep.c index 3a4b3451..84f955f9 100644 --- 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;