Accepted patch from Mark Hindley which avoids clearing realpath information
in pidof when trying to find matching executables.
This commit is contained in:
parent
e7f4361bde
commit
c06458e1c1
@ -8,6 +8,8 @@ sysvinit (3.07) released; urgency=low
|
|||||||
In other words, "pidof /tmp/sleep" and "pidof /usr/bin/sleep" will return
|
In other words, "pidof /tmp/sleep" and "pidof /usr/bin/sleep" will return
|
||||||
the same PIDs when /tmp/sleep is a symbolic link to /usr/bin/sleep.
|
the same PIDs when /tmp/sleep is a symbolic link to /usr/bin/sleep.
|
||||||
* Fixed memory initialization error in pidof. Fix provided by Markus Fischer.
|
* Fixed memory initialization error in pidof. Fix provided by Markus Fischer.
|
||||||
|
* Accepted patch from Mark Hindle which avoids clearing realpath information
|
||||||
|
in pidof when trying to find matching executables.
|
||||||
|
|
||||||
|
|
||||||
sysvinit (3.06) released; urgency=low
|
sysvinit (3.06) released; urgency=low
|
||||||
|
@ -94,7 +94,7 @@ that it returns PIDs of running programs that happen to have the same name
|
|||||||
as the program you're after but are actually other programs. Note
|
as the program you're after but are actually other programs. Note
|
||||||
that the executable name of running processes is calculated with
|
that the executable name of running processes is calculated with
|
||||||
.BR readlink (2),
|
.BR readlink (2),
|
||||||
so symbolic links to executables will also match. However, symbolic links to symbolic links will not match.
|
so symbolic links to executables will also match.
|
||||||
.PP
|
.PP
|
||||||
Zombie processes or processes in disk sleep (states Z and D, respectively)
|
Zombie processes or processes in disk sleep (states Z and D, respectively)
|
||||||
are ignored, as attempts to access the stats of these will sometimes fail.
|
are ignored, as attempts to access the stats of these will sometimes fail.
|
||||||
|
@ -740,8 +740,8 @@ PIDQ_HEAD *pidof(char *prog)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Try to stat the executable. */
|
/* Try to stat the executable. */
|
||||||
|
memset(real_path, 0, sizeof(real_path));
|
||||||
if ( (prog[0] == '/') && ( realpath(prog, real_path) ) ) {
|
if ( (prog[0] == '/') && ( realpath(prog, real_path) ) ) {
|
||||||
memset(&real_path[0], 0, sizeof(real_path));
|
|
||||||
dostat++;
|
dostat++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user