kill.c correctness

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

kill.c correctness

pdcvgmh
"if (!*argv || *ep)" should be "if (!**argv || *ep)" but !**argv is
already granted by !isdigit(**argv)

Index: kill.c
===================================================================
RCS file: /cvs/src/bin/kill/kill.c,v
retrieving revision 1.9
diff -u -r1.9 kill.c
--- kill.c 27 Oct 2009 23:59:21 -0000 1.9
+++ kill.c 6 Jun 2011 04:18:54 -0000
@@ -65,7 +65,7 @@
  if (!isdigit(**argv))
  usage();
  numsig = strtol(*argv, &ep, 10);
- if (!*argv || *ep)
+ if (*ep)
  errx(1, "illegal signal number: %s", *argv);
  if (numsig >= 128)
  numsig -= 128;

Reply | Threaded
Open this post in threaded view
|

Re: kill.c correctness

Otto Moerbeek
Looks good, any other ok?

        -0tto

On Mon, Jun 06, 2011 at 01:32:57AM -0300, pablo caballero wrote:

> "if (!*argv || *ep)" should be "if (!**argv || *ep)" but !**argv is
> already granted by !isdigit(**argv)
>
> Index: kill.c
> ===================================================================
> RCS file: /cvs/src/bin/kill/kill.c,v
> retrieving revision 1.9
> diff -u -r1.9 kill.c
> --- kill.c 27 Oct 2009 23:59:21 -0000 1.9
> +++ kill.c 6 Jun 2011 04:18:54 -0000
> @@ -65,7 +65,7 @@
>   if (!isdigit(**argv))
>   usage();
>   numsig = strtol(*argv, &ep, 10);
> - if (!*argv || *ep)
> + if (*ep)
>   errx(1, "illegal signal number: %s", *argv);
>   if (numsig >= 128)
>   numsig -= 128;

Reply | Threaded
Open this post in threaded view
|

Re: kill.c correctness

David Coppa
On Mon, Jun 6, 2011 at 9:16 AM, Otto Moerbeek <[hidden email]> wrote:
> Looks good, any other ok?

yep. ok for me too.

ciao,
David

> On Mon, Jun 06, 2011 at 01:32:57AM -0300, pablo caballero wrote:
>
>> "if (!*argv || *ep)" should be "if (!**argv || *ep)" but !**argv is
>> already granted by !isdigit(**argv)
>>
>> Index: kill.c
>> ===================================================================
>> RCS file: /cvs/src/bin/kill/kill.c,v
>> retrieving revision 1.9
>> diff -u -r1.9 kill.c
>> --- kill.c    27 Oct 2009 23:59:21 -0000      1.9
>> +++ kill.c    6 Jun 2011 04:18:54 -0000
>> @@ -65,7 +65,7 @@
>>                       if (!isdigit(**argv))
>>                               usage();
>>                       numsig = strtol(*argv, &ep, 10);
>> -                     if (!*argv || *ep)
>> +                     if (*ep)
>>                               errx(1, "illegal signal number: %s", *argv);
>>                       if (numsig >= 128)
>>                               numsig -= 128;