set close-on-exec for all sockets
Bug #1006186 reported by
Jason Toffaletti
This bug affects 1 person
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| libmemcached |
Fix Released
|
Medium
|
Brian Aker | ||
Bug Description
libmemcached doesn't set close-on-exec so all of the file descriptors it creates are inherited by child processes. As far as I can tell, the children can't use these file descriptors for any useful purpose so its a resource leak.
all socket() calls should add " | SOCK_CLOEXEC" to the socket type argument. if the platform doesn't support SOCK_CLOEXEC, but children inherit parent fd, then SOCK_CLOEXEC can be defined to 0 to make the compiler happy, and fnctl can be used to set FD_CLOEXEC.
| Changed in libmemcached: | |
| status: | In Progress → Fix Released |
To post a comment you must log in.

I will be curious to see how many platforms this works on now a days :)
Thanks for pointing this out!