From: Markus Rechberger <mrechberger@empiatech.com> Hi, when the dbus library spawns out dbus-launch it inherits all the filedescriptors from the parent. This causes problems in several ways for example when the inherited file is a devicenode, it won't be closed until dbus gets shut down. As for multimedia devices when mplayer starts up and opens for example the video4linux node dbus will inherit that filedescriptor and the device will never be closed. For devices which support multiple devicemodes this lock the device in the certain mode. Attached a patch which fixes that problem.
Created attachment 16558 [details] [review] don't inherit fds
Created attachment 16559 [details] [review] don't inherit fds (removed if check)
I was about to follow up on that =) Looks like a reasonable patch to me.
Comment on attachment 16559 [details] [review] don't inherit fds (removed if check) This should look more like in glib/gspawn.c ; should use fdwalk() if available, and probably sysconf() or getrlimit() would be more modern than getdtablesize(). Can't just cut-and-paste glib code though, due to license. Maybe the author of that code would be willing to relicense, though it is not complex to reimplement.
Created attachment 16665 [details] [review] using posix sysconf(_SC_OPEN_MAX) instead getdtablesize
I had a quick look at how Python's subprocess module does it; it basically uses sysconf to get the max fds, and then calls a new function "os.closerange", which is just a basic loop doing close() over the fd range. fdwalk() seems like a Solaris-specific function? I would say let a patch for that be written/tested by someone from the OpenSolaris community if they want it. Stylistically this patch doesn't match the rest of the code - need a space between name and function call and the for loop. After that's fixed r=me.
commit e2bc7232069b14b7299cb8b2eab436f60a232007 Author: Colin Walters <walters@verbum.org> Date: Wed May 28 16:01:22 2008 -0400 Bug 15947: Close file descriptors before execing helper (Markus Rechberger) * dbus/dbus-sysdeps-unix.c (_dbus_get_autolaunch_address): Close file descriptors before exec.
*** Bug 10777 has been marked as a duplicate of this bug. ***
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.