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

Richard W.M. Jones rjones at redhat.com
Wed Apr 13 22:00:51 UTC 2016


On Wed, Apr 13, 2016 at 03:53:27PM -0600, Eric Blake wrote:
> > +    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. :(

Yup, I hate POSIX too.  I'll change these to a write() call.

> > +  if (waitpid (pid, &status, 0) == -1) {
> > +    perrorf (g, "waitpid");
> > +    return -1;
> > +  }
> 
> Doesn't this need to loop on EINTR, rather than immediately giving up?

I think that's a systematic error throughout libguestfs.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list