From 46d8874d5b2fcb7831dd84c5e2f6df51922a7936 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 18 Apr 2017 14:09:01 +0200 Subject: Assume that pipe2 is always available The Debian patches for Hurd (which are already required to build glibc before this commit) contain an implementation of pipe2. --- posix/wordexp.c | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) (limited to 'posix') diff --git a/posix/wordexp.c b/posix/wordexp.c index ba3f3ed4b6..8567c9fc50 100644 --- a/posix/wordexp.c +++ b/posix/wordexp.c @@ -836,10 +836,7 @@ exec_comm_child (char *comm, int *fildes, int showerr, int noexec) { #ifdef O_CLOEXEC /* Reset the close-on-exec flag (if necessary). */ -# ifndef __ASSUME_PIPE2 - if (__have_pipe2 > 0) -# endif - __fcntl (fildes[1], F_SETFD, 0); + __fcntl (fildes[1], F_SETFD, 0); #endif } @@ -905,31 +902,8 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length, if (!comm || !*comm) return 0; -#ifdef O_CLOEXEC -# ifndef __ASSUME_PIPE2 - if (__have_pipe2 >= 0) -# endif - { - int r = __pipe2 (fildes, O_CLOEXEC); -# ifndef __ASSUME_PIPE2 - if (__have_pipe2 == 0) - __have_pipe2 = r != -1 || errno != ENOSYS ? 1 : -1; - - if (__have_pipe2 > 0) -# endif - if (r < 0) - /* Bad */ - return WRDE_NOSPACE; - } -#endif -#ifndef __ASSUME_PIPE2 -# ifdef O_CLOEXEC - if (__have_pipe2 < 0) -# endif - if (__pipe (fildes) < 0) - /* Bad */ - return WRDE_NOSPACE; -#endif + if (__pipe2 (fildes, O_CLOEXEC) < 0) + return WRDE_NOSPACE; again: if ((pid = __fork ()) < 0) -- cgit 1.4.1