contain: fail of fcntl(F_GETFD) fails for a fd with something else then EBADFD
This commit is contained in:
parent
f388cad3e0
commit
c1515459d7
@ -206,9 +206,13 @@ static bool containMakeFdsCOENaive(nsjconf_t* nsjconf) {
|
||||
*/
|
||||
for (unsigned fd = 0; fd < 1024; fd++) {
|
||||
int flags = TEMP_FAILURE_RETRY(fcntl(fd, F_GETFD, 0));
|
||||
if (flags == -1) {
|
||||
if (flags == -1 && errno == EBADF) {
|
||||
continue;
|
||||
}
|
||||
if (flags == -1) {
|
||||
PLOG_E("Couldn't get flags for fd=%d", fd)
|
||||
return false;
|
||||
}
|
||||
if (containPassFd(nsjconf, fd)) {
|
||||
LOG_D("fd=%d will be passed to the child process", fd);
|
||||
if (TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, flags & ~(FD_CLOEXEC))) == -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user