search for: 32bc96a

Displaying 1 result from an estimated 1 matches for "32bc96a".

Did you mean: 32bc96a7
2019 Aug 27
1
[PATCH nbdkit] server: Try hard to maintain invariant that fds 0, 1 and 2 are always open.
...fd = fds[i]; + fl = fcntl (fd, F_GETFL, NULL); + if (fl == -1 && errno == EBADF) + /* This is best effort - don't fail. */ + open ("/dev/null", fd == STDIN_FILENO ? O_RDONLY : O_WRONLY); + } +} diff --git a/common/utils/utils.c b/common/utils/utils.c index 32bc96a..c818d4c 100644 --- a/common/utils/utils.c +++ b/common/utils/utils.c @@ -190,3 +190,32 @@ set_nonblock (int fd) { } return fd; } + +/* Calls close (fd). As a special case if fd is stdin/stdout/stderr + * then it reopens the file descriptor on /dev/null. This allows us + * to maintain cert...