set close-on-exec for all sockets

Bug #1006186 reported by Jason Toffaletti on 2012-05-30
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libmemcached
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.

Brian Aker (brianaker) wrote :

I will be curious to see how many platforms this works on now a days :)

Thanks for pointing this out!

Changed in libmemcached:
importance: Undecided → Medium
assignee: nobody → Brian Aker (brianaker)
milestone: none → 1.0.9
status: New → In Progress
Brian Aker (brianaker) on 2012-07-06
Changed in libmemcached:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers