Back to index

glibc  2.9
open.c
Go to the documentation of this file.
00001 /* Copyright (C) 1991,1995,1996,1997,2002,2007 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #include <errno.h>
00020 #include <fcntl.h>
00021 #include <stdarg.h>
00022 #include <stddef.h>
00023 #include <stdio.h>
00024 
00025 extern char **__libc_argv attribute_hidden;
00026 
00027 /* Open FILE with access OFLAG.  If OFLAG includes O_CREAT,
00028    a third argument is the file protection.  */
00029 int
00030 __open (file, oflag)
00031      const char *file;
00032      int oflag;
00033 {
00034   int mode;
00035 
00036   if (file == NULL)
00037     {
00038       __set_errno (EINVAL);
00039       return -1;
00040     }
00041 
00042   if (oflag & O_CREAT)
00043     {
00044       va_list arg;
00045       va_start(arg, oflag);
00046       mode = va_arg(arg, int);
00047       va_end(arg);
00048     }
00049 
00050   __set_errno (ENOSYS);
00051   return -1;
00052 }
00053 libc_hidden_def (__open)
00054 stub_warning (open)
00055 
00056 weak_alias (__open, open)
00057 
00058 
00059 int
00060 __open_2 (file, oflag)
00061      const char *file;
00062      int oflag;
00063 {
00064   if (oflag & O_CREAT)
00065     __fortify_fail ("invalid open call: O_CREAT without mode");
00066 
00067   return __open (file, oflag);
00068 }
00069 stub_warning (__open_2)
00070 
00071 #include <stub-tag.h>