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

Re: time(1): Return value and sys/wait.h macros



Dirk Eddelbuettel <edd@debian.org> wrote:
> 
> I've been asked (#203804) to supply an entry in the Debian manual page of my
> GNU time package (which, btw, is orphaned upstream, any takers ?). 
> 
> The main() function ends on
> 
>  if (WIFSTOPPED (res.waitstatus))
>    exit (WSTOPSIG (res.waitstatus));
>  else if (WIFSIGNALED (res.waitstatus))
>    exit (WTERMSIG (res.waitstatus));
>  else if (WIFEXITED (res.waitstatus))
>    exit (WEXITSTATUS (res.waitstatus));

This is buggy, for the first two cases it should return signal + 128.
Otherwise

sh -c 'kill -9 $$'

and

/usr/bin/time sh -c 'kill -9 $$'

will return different things.
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Reply to: