Hi,
libgamin 0.1.10 does not seem to set the FD_CLOEXEC flag on the file
descriptor opened in FAMOpen2. The calling code can obviously set this
flag using fcntl(2), but:
Any time a file descriptor can come into existence without FD_CLOEXEC
being set on it, you have a race between thread A creating the file
descriptor and then setting FD_CLOEXEC and thread B doing a fork() and
exec(). If thread B 'wins' this race, it will inherit a new file
descriptor that does not have FD_CLOEXEC set and this file descriptor
will leak through the exec(). [1]
As a solution, libgamin could either set the FD_CLOEXEC flag (which can be
safely re-set afterwards, if needed) or offer an option to the calling
code whether to set FD_CLOEXEC, as for example pipe2(2) does.
Roland
[1] http://utcc.utoronto.ca/~cks/space/blog/unix/ForkFDsAndRaces
_______________________________________________
gamin-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gamin-list