Bug#1033311: sysvinit-utils: pidof not always returning a pid when using the full path to a program

Jesse Smith jsmith at resonatingmedia.com
Fri Mar 24 14:17:20 GMT 2023



On 2023-03-24 6:44 a.m., Markus Fischer wrote:
> I think I've figured it out. With the following patch I don't see the
> unexpected behaviour anymore:
>
> --- a/src/killall5.c
> +++ b/src/killall5.c
> @@ -662,6 +662,7 @@ int readproc()
>                 /* Try to stat the executable. */
>                 snprintf(path, sizeof(path), "/proc/%s/exe", d->d_name);
>                  p->pathname = (char *)xmalloc(PATH_MAX);
> +               memset(p->pathname, 0, PATH_MAX);
>                 if (readlink(path, p->pathname, PATH_MAX) == -1) {
>                         p->pathname = NULL;
>                 }
>

This patch looks good to me. I'm adding it upstream.

Will run some more tests before publishing 3.07. And would appreciate it
if everyone following this issue could test too and provide feedback.

- Jesse



More information about the Debian-init-diversity mailing list