]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - io/openat.c
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / io / openat.c
index c65ad19c7ab20ad48a8f50fe115f1a6c256e51e4..92fcacb818cc6f78623bb549b222bfc4ee258ada 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
 #include <fcntl.h>
 #include <stdarg.h>
 #include <stddef.h>
+#include <stdio.h>
 #include <sys/stat.h>
+#include <kernel-features.h>
+
+/* Some mostly-generic code (e.g. sysdeps/posix/getcwd.c) uses this variable
+   if __ASSUME_ATFCTS is not defined.  */
+#ifndef __ASSUME_ATFCTS
+int __have_atfcts;
+#endif
 
 /* Open FILE with access OFLAG.  Interpret relative paths relative to
-   the directory associated with FD.  If OFLAG includes O_CREAT, a
+   the directory associated with FD.  If O_CREAT or O_TMPFILE is in OFLAG, a
    third argument is the file protection.  */
 int
-__openat (fd, file, oflag)
-     int fd;
-     const char *file;
-     int oflag;
+__openat (int fd, const char *file, int oflag, ...)
 {
   int mode;
 
@@ -53,12 +57,14 @@ __openat (fd, file, oflag)
        }
     }
 
-  if (oflag & O_CREAT)
+  if (__OPEN_NEEDS_MODE (oflag))
     {
       va_list arg;
       va_start (arg, oflag);
       mode = va_arg (arg, int);
       va_end (arg);
+
+      ignore_value (mode);
     }
 
   __set_errno (ENOSYS);
@@ -68,4 +74,6 @@ libc_hidden_def (__openat)
 weak_alias (__openat, openat)
 stub_warning (openat)
 
-#include <stub-tag.h>
+/* __openat_2 is a generic wrapper that calls __openat.
+   So give a stub warning for that symbol too.  */
+stub_warning (__openat_2)