update from texinfo
[gnulib.git] / lib / fchdir.c
index 7a30448..969e984 100644 (file)
@@ -19,6 +19,7 @@
 /* Specification.  */
 #include <unistd.h>
 
+#include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <stdarg.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <dirent.h>
 
 #include "canonicalize.h"
-#include "dirfd.h"
 
 /* This replacement assumes that a directory is not renamed while opened
    through a file descriptor.  */
@@ -105,52 +104,6 @@ _gl_register_fd (int fd, const char *filename)
     }
 }
 
-/* Override open() and close(), to keep track of the open file descriptors.  */
-
-int
-rpl_close (int fd)
-#undef close
-{
-  int retval = close (fd);
-
-  if (retval >= 0)
-    _gl_unregister_fd (fd);
-  return retval;
-}
-
-int
-rpl_open (const char *filename, int flags, ...)
-#undef open
-{
-  mode_t mode;
-  int fd;
-  struct stat statbuf;
-
-  mode = 0;
-  if (flags & O_CREAT)
-    {
-      va_list arg;
-      va_start (arg, flags);
-
-      /* If mode_t is narrower than int, use the promoted type (int),
-        not mode_t.  Use sizeof to guess whether mode_t is narrower;
-        we don't know of any practical counterexamples.  */
-      mode = (sizeof (mode_t) < sizeof (int)
-             ? va_arg (arg, int)
-             : va_arg (arg, mode_t));
-
-      va_end (arg);
-    }
-#if defined GNULIB_OPEN && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
-  if (strcmp (filename, "/dev/null") == 0)
-    filename = "NUL";
-#endif
-  fd = open (filename, flags, mode);
-  if (fd >= 0)
-    _gl_register_fd (fd, filename);
-  return fd;
-}
-
 /* Override opendir() and closedir(), to keep track of the open file
    descriptors.  Needed because there is a function dirfd().  */