kill.c correctness

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

kill.c correctness

pdcvgmh
From /usr/src/bin/kill/kill.c

if (!isdigit(**argv))
    usage();
numsig = strtol(*argv, &ep, 10);
if (!*argv || *ep)
    errx(1, "illegal signal number: %s", *argv);

Should not be "if (!**argv || *ep)" instead of "if (!*argv || *ep)"?

And if it is true, is it already guaranteed by if (!isdigit(**argv))?

From strtol(3) man page:
lval = strtol(buf, &ep, 10);
if (buf[0] == '\0' || *ep != '\0')
    goto not_a_number;

If I'm right, can I send a diff?

Regards

Reply | Threaded
Open this post in threaded view
|

Re: kill.c correctness

Pedro Martelletto
> If I'm right, can I send a diff?

You don't need to be right to send a diff (been there, done that).

-p.