dbus-sysdeps-unix.h

Thiago Macieira thiago at kde.org
Wed Sep 13 07:15:38 PDT 2006


Havoc Pennington wrote:
>Essentially all fd's need to be close on exec (it should have been the
>default really) or when you fork/exec you get a bunch of fd leaks.
>
>The glib g_spawn_ functions have an option to do this for you:
>  for (i = 3; i < max_fds; ++i) {
>     set_close_on_exec(i); /* ignore errors, most of these numbers are
>                              not valid fds obviously */
>  }
>
>since dbus sets everything close on exec on creation, it doesn't have to
>do this gross hack though.
>
>I think set_close_on_exec could be a no-op on windows ? depends on how
>dbus-spawn.c is replaced on windows.

No streams survive in the child process on Windows except stdin, stdout 
and stderr (IIRC). The Windows-equivalent of dbus_spawn_* doesn't have to 
worry about the file descriptors.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20060913/16aba298/attachment.pgp


More information about the dbus mailing list