On 5/7/21 7:25 AM, Steve Sistare wrote:
> Add a qemu_exec_requested() hook that causes the main loop to exit and
> re-exec qemu using the same initial arguments.  If /usr/bin/qemu-exec
> exists, exec that instead.  This is an optional site-specific trampoline
> that may alter the environment before exec'ing the qemu binary.
> 
> Signed-off-by: Steve Sistare <steven.sist...@oracle.com>
> ---

> +static void qemu_exec(void)
> +{
> +    const char *helper = "/usr/bin/qemu-exec";
> +    const char *bin = !access(helper, X_OK) ? helper : argv_main[0];

Reads awkwardly; I would have used '...= access(helper, X_OK) == 0 ?...'

> +
> +    execvp(bin, argv_main);
> +    error_report("execvp failed, errno %d.", errno);

error_report should not be used with a trailing dot.  Also, %d for errno
is awkward, better is:

error_report("execvp failed: %s", strerror(errno));

> +    exit(1);

We aren't consistent about use of EXIT_FAILED.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


Reply via email to