tool: checkfds, open on null device
No binary (build failed)
—
(log yok)
| @@ -73,7 +73,6 @@ int _CRT_glob = 0; | |
| /* if we build a static library for unit tests, there is no main() function */ | |
| #ifndef UNITTESTS | |
| - | #if defined(HAVE_PIPE) && defined(HAVE_FCNTL) |
| /* | |
| * Ensure that file descriptors 0, 1 and 2 (stdin, stdout, stderr) are | |
| * open before starting to run. Otherwise, the first three network | |
| @@ -86,17 +85,27 @@ int _CRT_glob = 0; | |
| */ | |
| static int main_checkfds(void) | |
| { | |
| - | int fd[2]; |
| - | while((fcntl(STDIN_FILENO, F_GETFD) == -1) || |
| - | (fcntl(STDOUT_FILENO, F_GETFD) == -1) || |
| - | (fcntl(STDERR_FILENO, F_GETFD) == -1)) |
| - | if(pipe(fd)) |
| + | #if defined(HAVE_FCNTL) && defined(HAVE_PIPE) |
| + | const char * const devnull = "/dev/null"; |
| + | int fd; |
| + | while((fcntl(STDIN_FILENO, F_GETFD) == -1)) { |
| + | fd = curlx_open(devnull, O_RDONLY); |
| + | if(fd < 0) |
| return 1; | |
| + | } |
| + | while((fcntl(STDOUT_FILENO, F_GETFD) == -1)) { |
| + | fd = curlx_open(devnull, O_WRONLY); |
| + | if(fd < 0) |
| + | return 1; |
| + | } |
| + | while((fcntl(STDERR_FILENO, F_GETFD) == -1)) { |
| + | fd = curlx_open(devnull, O_WRONLY); |
| + | if(fd < 0) |
| + | return 1; |
| + | } |
| + | #endif /* HAVE_FCNTL && HAVE_PIPE */ |
| return 0; | |
| } | |
| - | #else |
| - | #define main_checkfds() 0 |
| - | #endif |
| #ifdef CURL_MEMDEBUG | |
| static void memory_tracking_init(void) | |