@@ -184,30 +184,13 @@ const char* ffProcessReadOutput(FFProcessHandle* handle, FFstrbuf* buffer)
184184 waitpid (childPid , NULL , 0 );
185185 return "poll(&pollfd, 1, timeout) timeout (try increasing --processing-timeout)" ;
186186 }
187- else if (pollret < 0 )
188- {
189- if (errno == EINTR )
190- {
191- // The child process has been terminated. See `chldSignalHandler` in `common/init.c`
192- if (waitpid (childPid , NULL , WNOHANG ) == childPid )
193- {
194- // Read remaining data from the pipe
195- fcntl (childPipeFd , F_SETFL , O_CLOEXEC | O_NONBLOCK );
196- childPid = -1 ;
197- }
198- }
199- else
200- {
201- kill (childPid , SIGTERM );
202- waitpid (childPid , NULL , 0 );
203- return "poll(&pollfd, 1, timeout) error: not EINTR" ;
204- }
205- }
206- else if (pollfd .revents & POLLERR )
187+ else if (pollret < 0 || (pollfd .revents & POLLERR ))
207188 {
208189 kill (childPid , SIGTERM );
209190 waitpid (childPid , NULL , 0 );
210- return "poll(&pollfd, 1, timeout) error: POLLERR" ;
191+ return pollret < 0
192+ ? "poll(&pollfd, 1, timeout) error: pollret < 0"
193+ : "poll(&pollfd, 1, timeout) error: pollfd.revents & POLLERR" ;
211194 }
212195 }
213196
@@ -229,12 +212,7 @@ const char* ffProcessReadOutput(FFProcessHandle* handle, FFstrbuf* buffer)
229212 return NULL ;
230213 }
231214 else if (nRead < 0 )
232- {
233- if (errno == EAGAIN )
234- return NULL ;
235- else
236- break ;
237- }
215+ break ;
238216 }
239217
240218 return "read(childPipeFd, str, FF_PIPE_BUFSIZ) failed" ;
0 commit comments