]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Include openat-priv.h.
authorJim Meyering <jim@meyering.net>
Wed, 30 Nov 2005 13:04:26 +0000 (13:04 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 30 Nov 2005 13:04:26 +0000 (13:04 +0000)
Remove definitions of macros defined therein.

lib/mkdirat.c
lib/openat.c

index 140f96a96ac277a52dad763bff4db43698827e38..b9ba52dcdd2e53b13a1a0cfadf822ca43dcdef5f 100644 (file)
@@ -1,5 +1,5 @@
 /* provide a replacement openat function
-   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #include "openat.h"
 
 #include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
 
-#include "alloca.h"
 #include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
-#include "intprops.h"
 #include "save-cwd.h"
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
-/* Set PROC_FD_FILENAME to the expansion of "/proc/self/fd/%d/%s" in
-   alloca'd memory, using FD and FILE, respectively for %d and %s. */
-#define BUILD_PROC_NAME(Proc_fd_filename, Fd, File)                    \
-  do                                                                   \
-    {                                                                  \
-      size_t filelen = strlen (File);                                  \
-      static const char procfd[] = "/proc/self/fd/%d/%s";              \
-      /* Buffer for the file name we are going to use.  It consists of \
-        - the string /proc/self/fd/                                    \
-        - the file descriptor number                                   \
-        - the file name provided.                                      \
-        The final NUL is included in the sizeof.                       \
-        Subtract 4 to account for %d and %s.  */                       \
-      size_t buflen = sizeof (procfd) - 4 + INT_STRLEN_BOUND (Fd) + filelen; \
-      (Proc_fd_filename) = alloca (buflen);                            \
-      snprintf ((Proc_fd_filename), buflen, procfd, (Fd), (File));     \
-    }                                                                  \
-  while (0)
-
-/* Trying to access a BUILD_PROC_NAME file will fail on systems without
-   /proc support, and even on systems *with* ProcFS support.  Return
-   nonzero if the failure may be legitimate, e.g., because /proc is not
-   readable, or the particular .../fd/N directory is not present.  */
-#define EXPECTED_ERRNO(Errno) \
-  ((Errno) == ENOTDIR || (Errno) == ENOENT \
-   || (Errno) == EPERM || (Errno) == EACCES \
-   || (Errno) == EOPNOTSUPP /* FreeBSD */)
+#include "openat-priv.h"
 
 /* Solaris 10 has no function like this.
    Create a subdirectory, FILE, with mode MODE, in the directory
index 32424eb4f8b1d6514d2678887ecf874d1a4859ff..1c6d6d728fd2ae18e7c70fe843391950d5ef1a0a 100644 (file)
 
 #include <stdlib.h>
 #include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
 #include <unistd.h>
 #include <errno.h>
 #include <fcntl.h>
 
-#include "alloca.h"
 #include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */
-#include "intprops.h"
 #include "save-cwd.h"
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
-/* Set PROC_FD_FILENAME to the expansion of "/proc/self/fd/%d/%s" in
-   alloca'd memory, using FD and FILE, respectively for %d and %s. */
-#define BUILD_PROC_NAME(Proc_fd_filename, Fd, File)                    \
-  do                                                                   \
-    {                                                                  \
-      size_t filelen = strlen (File);                                  \
-      static const char procfd[] = "/proc/self/fd/%d/%s";              \
-      /* Buffer for the file name we are going to use.  It consists of \
-        - the string /proc/self/fd/                                    \
-        - the file descriptor number                                   \
-        - the file name provided.                                      \
-        The final NUL is included in the sizeof.                       \
-        Subtract 4 to account for %d and %s.  */                       \
-      size_t buflen = sizeof (procfd) - 4 + INT_STRLEN_BOUND (Fd) + filelen; \
-      (Proc_fd_filename) = alloca (buflen);                            \
-      snprintf ((Proc_fd_filename), buflen, procfd, (Fd), (File));     \
-    }                                                                  \
-  while (0)
-
-/* Trying to access a BUILD_PROC_NAME file will fail on systems without
-   /proc support, and even on systems *with* ProcFS support.  Return
-   nonzero if the failure may be legitimate, e.g., because /proc is not
-   readable, or the particular .../fd/N directory is not present.  */
-#define EXPECTED_ERRNO(Errno) \
-  ((Errno) == ENOTDIR || (Errno) == ENOENT \
-   || (Errno) == EPERM || (Errno) == EACCES \
-   || (Errno) == EOPNOTSUPP /* FreeBSD */)
+#include "openat-priv.h"
 
 /* Replacement for Solaris' openat function.
    <http://www.google.com/search?q=openat+site:docs.sun.com>