dbus bugfix - close inherited filedescriptors

Markus Rechberger mrechberger at empiatech.com
Wed May 21 09:06:31 PDT 2008


Hi,
--- Thiago Macieira <thiago at kde.org> schrieb:

> Daniel P. Berrange wrote:
> >IMHO, it should close 0, 1, 2 as well, and re-open
> them to
> >point to /dev/null.
> 
> stdout and stderr are already reopened to pipes that
> the library uses to 
> read the dbus-launch output. stdin is closed.
> 
> Current code:
>       /* set-up stdXXX */
>       close (address_pipe[READ_END]);
>       close (errors_pipe[READ_END]);
>       close (0);                /* close stdin */
>       close (1);                /* close stdout */
>       close (2);                /* close stderr */
> 
>       if (dup2 (fd, 0) == -1)
>         _exit (1);
>       if (dup2 (address_pipe[WRITE_END], 1) == -1)
>         _exit (1);
>       if (dup2 (errors_pipe[WRITE_END], 2) == -1)
>         _exit (1);
> 
> where fd is /dev/null.
> 

I will regenerate the patch with sysconf
(_SC_OPEN_MAX); instead of getdtablesize().

thanks,
Markus


More information about the dbus mailing list