emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Add facility to collect stderr of async subprocess


From: Paul Eggert
Subject: Re: [PATCH] Add facility to collect stderr of async subprocess
Date: Tue, 07 Apr 2015 17:47:20 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

I took a quick look, and in the ordinary POSIXish code there's a race condition between the calls to pipe2 and the calls to fcntl with FD_CLOEXEC. If some other thread forks and execs a process after pipe2 but before fcntl, that process will have access to the pipe ends and this could cause problems. Instead, please call pipe2 (.., O_BINARY | O_CLOEXEC) so that the other process won't see the pipe end. Any child process that needs to have the pipe end survive an exec should then call fcntl (pipe_end, F_SETFD, 0) before execing. This is how the existing Emacs code works. So, there should be no need to call fcntl (inchannel, F_SETFD, FD_CLOEXEC) and likewise for outchannel.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]