On Wed, Mar 15, 2023 at 12:01:56PM +0100, Laszlo Ersek wrote:
> Add an assert() variant that we may call between fork() and exec*().
>
> Signed-off-by: Laszlo Ersek <[email protected]>
> ---
>
> +void
> +nbd_internal_fork_safe_assert (int result, const char *file, long line,
> + const char *func, const char *assertion)
> +{
> + const char *line_out;
> + char line_buf[32];
> +
> + if (result)
> + return;
> +
> + line_out = nbd_internal_fork_safe_itoa (line, line_buf, sizeof line_buf);
> + xwritel (STDERR_FILENO, file, ":", line_out, ": ", func, ": Assertion `",
> + assertion, "' failed.\n", (char *)NULL);
xwritel() makes this so much shorter ;)
Reviewed-by: Eric Blake <[email protected]>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
_______________________________________________
Libguestfs mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/libguestfs