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
This commit is contained in:
Alfredo Esteban 2012-07-07 03:15:15 +02:00 committed by Craig Small
parent 30d5db1a8d
commit 7696bd200e

View File

@ -241,7 +241,6 @@ static struct el *read_pidfile(void)
n = read(fd,buf+1,sizeof buf-2); n = read(fd,buf+1,sizeof buf-2);
if (n<1) if (n<1)
goto out; goto out;
buf[n] = '\0';
pid = strtoul(buf+1,&endp,10); pid = strtoul(buf+1,&endp,10);
if(endp<=buf+1 || pid<1 || pid>0x7fffffff) if(endp<=buf+1 || pid<1 || pid>0x7fffffff)
goto out; goto out;