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 <ler...@redhat.com> > --- >
> +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 <ebl...@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs