[Libguestfs] [PATCH libguestfs] launch: Implement a safer getumask.

Eric Blake eblake at redhat.com
Wed Apr 13 21:58:52 UTC 2016


On 04/13/2016 03:53 PM, Eric Blake wrote:
>> +    mask = umask (0);
>> +    if (mask == -1) {
>> +      perror ("umask");
> 
> perror() is NOT async-safe (it manipulates stdio, and could permanently
> wedgelock the child if you happened to fork() while some other thread
> was also using stdio).  Safe error reporting in a fork()d child is
> basically impossible; the best you can do is write() something back to
> the parent and let the parent do the error reporting. :(

The official list is at:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04
at the end of subheading 2.4.3

although you'll want to also consult

http://austingroupbugs.net/view.php?id=692

for several functions (like strlen()) that were accidentally omitted
from the list and will appear when POSIX 2008 TC 2 comes out later this
year.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160413/c39b38d4/attachment.sig>


More information about the Libguestfs mailing list