Opened 12 years ago

Closed 12 years ago

#168 closed defect (fixed)

libc: close filehandles on exec

Reported by: bird Owned by: bird
Priority: normal Milestone: libc-0.6.3
Component: libc-backend Version: 0.6
Severity: normal Keywords: exec close filehandles hang
Cc:

Description

Since the process calling exec*() isn't terminated until the child has completed, file handles needs to be closed asap after the child has been spawned. We're currently not closing anything. In a fork()+exec() sequence this will leave close-on-exec file handles open when the parent expects them to be closed. And in both fork()+exec() and spawn() scenarios any inherited handles the child closes will remain open in the exec() process.

For normal files sharing violations may occur should the file be attempted reopened or deleted. For pipes there might be unexpected hangs because both ends of a pipe remains open when they should. For sockets, the connection may not be taken down when expected (both parent and child) because the exec process keeps it from being closed.

Change History (1)

comment:1 Changed 12 years ago by bird

  • Resolution set to fixed
  • Status changed from new to closed

(In [3373]) Wait for spawned/execed child so it can finish inherting us. Close file handles on exec. Fixes #168.Fixes #167.

Note: See TracTickets for help on using tickets.