[Libguestfs] [PATCH v2 1/2] lib: command: If command fails, exit with 126 or 127 as defined by POSIX.

Pino Toscano ptoscano at redhat.com
Thu Nov 16 12:43:12 UTC 2017


On Friday, 6 October 2017 15:52:16 CET Richard W.M. Jones wrote:
> If running the external command fails in "argv mode" (ie. when
> not using the shell), then exit with either 126 or 127 as defined
> by POSIX.
> 
> This is mostly the same as what bash does, see
> execute_cmd.c:shell_execve in the bash sources.
> 
> Note: saving errno around perror(3) if necessary, otherwise you will
> see different behaviour between verbose and non-verbose mode.  In
> non-verbose mode, perror(3) tried to print to a closed file
> descriptor, failing and overwriting errno.  That took some time to
> debug.
> ---

LGTM.

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20171116/2c1230eb/attachment.sig>


More information about the Libguestfs mailing list