Re: Issue with fcntl FD_CLOEXEC and execve

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* postmaster:

> The pipe works fine and the process can correctly transmit data back to the
> master. The only issue appears when trying to run input pump based
> applications like cat, grep, etc. When running these applications the pipe
> write end which is marked FC_CLOEXEC should be closed when execve is
> triggered, however it is not, but execve still succeeded.
> When the target process to execve is not an input pump (uname, ls, .) no
> issue occurs and the pipe is correctly closed when execve is triggered and
> succeeds.
>
> That is a problem as my master process expects the blocking read to return
> with either cause of pipe file descriptor closed or some data written. In
> this case when the target process is an input pump the master process never
> gets notified of file descriptor closed and by extension locks forever.

Do you have a minimal but complete example that shows the problem?

You cannot really make standard input a CLOEXEC descriptor.  If you do
not want subprocesses to use the original standard input, you need to
replace the descriptor with /dev/null before the execve call (but
already in the subprocess).



[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux