netdev
[Top] [All Lists]

FD_CLOEXEC doesn't take affect through a system("foo") call??

To: "'netdev@xxxxxxxxxxx'" <netdev@xxxxxxxxxxx>
Subject: FD_CLOEXEC doesn't take affect through a system("foo") call??
From: Ben Greear <greearb@xxxxxxxxxxxxxxx>
Date: Sun, 30 Jan 2005 22:39:14 -0800
Organization: Candela Technologies
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.3) Gecko/20041020
I found a funny thing in the 2.6.9 kernel.  Not sure if it only
happens here, or if it's even a bug, but it was unexpected to me at least...

I have a server that opens a listening socket, and sets the FD_CLOEXEC
bit, among other things.  Sometime later, it creates a pppd.bash file
that just starts pppd in the background. From my main process, I
execute the pppd.bash script with the system() command.

My expectation is that pppd would be spawned and that it would NOT
be also listening on the socket that my main server is using.  However,
that is not the case:  The pppd process has that socket and the rest of
the sockets & file-descriptos from the main process open.

I can work around this by explicitly forking, closing all FDs > 2, and
then running the system call, but is what I am seeing expected behaviour?

Thanks,
Ben

--
Ben Greear <greearb@xxxxxxxxxxxxxxx>
Candela Technologies Inc  http://www.candelatech.com


<Prev in Thread] Current Thread [Next in Thread>
  • FD_CLOEXEC doesn't take affect through a system("foo") call??, Ben Greear <=