projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
semtimedop: add time64 syscall support, decouple 32-bit time_t
[musl]
/
src
/
fcntl
/
open.c
diff --git
a/src/fcntl/open.c
b/src/fcntl/open.c
index
088a28f
..
1d817a2
100644
(file)
--- a/
src/fcntl/open.c
+++ b/
src/fcntl/open.c
@@
-1,15
+1,17
@@
#include <fcntl.h>
#include <stdarg.h>
#include "syscall.h"
#include <fcntl.h>
#include <stdarg.h>
#include "syscall.h"
-#include "libc.h"
int open(const char *filename, int flags, ...)
{
int open(const char *filename, int flags, ...)
{
- mode_t mode;
- va_list ap;
- va_start(ap, flags);
- mode = va_arg(ap, mode_t);
- va_end(ap);
+ mode_t mode = 0;
+
+ if ((flags & O_CREAT) || (flags & O_TMPFILE) == O_TMPFILE) {
+ va_list ap;
+ va_start(ap, flags);
+ mode = va_arg(ap, mode_t);
+ va_end(ap);
+ }
int fd = __sys_open_cp(filename, flags, mode);
if (fd>=0 && (flags & O_CLOEXEC))
int fd = __sys_open_cp(filename, flags, mode);
if (fd>=0 && (flags & O_CLOEXEC))
@@
-18,4
+20,4
@@
int open(const char *filename, int flags, ...)
return __syscall_ret(fd);
}
return __syscall_ret(fd);
}
-
LFS64(open
);
+
weak_alias(open, open64
);