dbus bugfix - close inherited filedescriptors
Thiago Macieira
thiago at kde.org
Fri May 16 00:03:04 PDT 2008
Markus Rechberger wrote:
>+ int maxfds = getdtablesize();
I suggest getrlimit(2) for RLIMIT_NOFILE.
> int fd = open ("/dev/null", O_RDWR);
>+
> if (fd == -1)
> /* huh?! can't open /dev/null? */
> _exit (1);
>@@ -2865,9 +2867,10 @@
> if (dup2 (errors_pipe[WRITE_END], 2) == -1)
> _exit (1);
>
>- close (fd);
>- close (address_pipe[WRITE_END]);
>- close (errors_pipe[WRITE_END]);
>+ /* close all inherited fds */
>+ for( i = 0; i<maxfds; i++)
>+ if (i>2)
>+ close(i);
for ( i = 0; ...)
if (i > 2)
why not simply do for (i = 3; .. ?
Also, maybe this should be in dbus-launch instead?
--
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: This is a digitally signed message part.
Url : http://lists.freedesktop.org/archives/dbus/attachments/20080516/64f45b15/attachment.pgp
More information about the dbus
mailing list