Re: [PATCH] Add misc-utils/timeout utility

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +/* TODO: merge with kill.c */
> +int arg_to_signum (char *arg)
> +{
> +    int numsig;
> +    char *ep;
> +
> +    if (isdigit(*arg)) {

This check is unnecessary.

> +        numsig = strtol(arg, &ep, 10);
> +        if (*ep!='\0' || numsig<0 || numsig>=NSIG)
> +            return -1;
> +        return numsig;
> +    }
> +    return -1;
> +}

[..snip..]

> +    } else {
> +        alarm(timeout);
> +
> +        /* We're just waiting for a single process here, so wait() suffices.
> +         * Note the signal() calls above on linux and BSD at least, essentially
> +         * call the lower level sigaction() with the SA_RESTART flag set, which
> +         * ensures the following wait call will only return if the child exits,
> +         * not on this process receiving a signal. Also we're not passing
> +         * WUNTRACED | WCONTINUED to a waitpid() call and so will not get
> +         * indication that the child has stopped or continued. */
> +        int status;

Move this declaration above 'alarm(timeout)' ?

> +        wait(&status);

--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux