Move pipe2-safer code to its own file.
[gnulib.git] / lib / pipe-safer.c
index fda5c52..2d51679 100644 (file)
@@ -54,31 +54,3 @@ pipe_safer (int fd[2])
 
   return -1;
 }
-
-#if GNULIB_PIPE2_SAFER
-/* Like pipe2, but ensure that neither of the file descriptors is
-   STDIN_FILENO, STDOUT_FILENO, or STDERR_FILENO.  */
-
-int
-pipe2_safer (int fd[2], int flags)
-{
-  if (pipe2 (fd, flags) == 0)
-    {
-      int i;
-      for (i = 0; i < 2; i++)
-        {
-          fd[i] = fd_safer_flag (fd[i], flags);
-          if (fd[i] < 0)
-            {
-              int e = errno;
-              close (fd[1 - i]);
-              errno = e;
-              return -1;
-            }
-        }
-
-      return 0;
-    }
-  return -1;
-}
-#endif /* GNULIB_PIPE2 */