Correct way to handle fork/exec errors with DBusServer

John Palmieri johnp at redhat.com
Thu Jan 8 08:44:19 PST 2009


An issue with fork that we run into is that if you exit your child before exec'ing the DBusServer socket is cleaned up and the socket file is unlinked on the disk (assuming you are not using abstract sockets).  On exec the socket is closed and DBusServer does not run the cleanup code path which is the correct behaviour.  

The biggest issue here is if exec fails (such as the executable not being found or permission denied) the child exits and takes down the socket with it.  We fixed this using _exit() instead of exit().  Is this correct or is there a better way of handling this?

--
John (J5) Palmieri
Software Engineer
Red Hat, Inc.


More information about the dbus mailing list