[Libguestfs] [PATCH libnbd v2 1/2] lib: Don't use perror after fork in nbd_connect_callback.
Eric Blake
eblake at redhat.com
Tue Oct 1 13:10:20 UTC 2019
On 9/30/19 4:27 PM, Eric Blake wrote:
> On 9/30/19 11:32 AM, Richard W.M. Jones wrote:
>> perror is not fork-safe and so could deadlock. Instead open code a
>> fork-safe version of perror. While this fixes the current behaviour,
>> in the long term we'd like to capture the error message into the usual
>> error mechanism, so this is not the full and final fix for this issue.
>>
>> Also this fixes the exit code to be 126/127 instead of 1.
>>
>> + write (2, s, strlen (s));
>
> Surprisingly, strlen() is not listed in current POSIX' list of
> async-signal-safe functions. But I have an open bug to remedy that, and
> don't see any problem in using it.
Correction - I forgot my own history. POSIX 2008 had indeed omitted it,
but my bug was accepted, and strlen() _is_ async-signal-safe in POSIX
2017, per http://austingroupbugs.net/view.php?id=692
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
More information about the Libguestfs
mailing list