#include <config.h>#include "fcntl-safer.h"#include <fcntl.h>#include <stdarg.h>#include "unistd-safer.h"Go to the source code of this file.
Functions | |
| int | open_safer (char const *file, int flags,...) |
|
||||||||||||||||
|
Definition at line 30 of file open-safer.c. References fd_safer(), O_CREAT, and open. 00031 { 00032 mode_t mode = 0; 00033 00034 if (flags & O_CREAT) 00035 { 00036 va_list ap; 00037 va_start (ap, flags); 00038 00039 /* Assume mode_t promotes to int if and only if it is smaller. 00040 This assumption isn't guaranteed by the C standard, but we 00041 don't know of any real-world counterexamples. */ 00042 mode = (sizeof (mode_t) < sizeof (int) 00043 ? va_arg (ap, int) 00044 : va_arg (ap, mode_t)); 00045 00046 va_end (ap); 00047 } 00048 00049 return fd_safer (open (file, flags, mode)); 00050 }
|