summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps/linux/common/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/open.c')
-rw-r--r--libc/sysdeps/linux/common/open.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c
index 822ac4f63..b4bef3c63 100644
--- a/libc/sysdeps/linux/common/open.c
+++ b/libc/sysdeps/linux/common/open.c
@@ -7,7 +7,7 @@
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
-#include "syscalls.h"
+#include <sys/syscall.h>
#include <stdlib.h>
#include <stdarg.h>
#include <fcntl.h>
@@ -15,26 +15,25 @@
#include <sys/param.h>
extern __typeof(open) __libc_open;
-libc_hidden_proto(__libc_open)
+extern __typeof(creat) __libc_creat;
#define __NR___syscall_open __NR_open
static inline _syscall3(int, __syscall_open, const char *, file,
int, flags, __kernel_mode_t, mode);
-int __libc_open(const char *file, int flags, ...)
+libc_hidden_proto(__libc_open)
+int __libc_open(const char *file, int oflag, ...)
{
- /* gcc may warn about mode being uninitialized.
- * Just ignore that, since gcc is wrong. */
- mode_t mode;
+ mode_t mode = 0;
- if (flags & O_CREAT) {
- va_list ap;
-
- va_start(ap, flags);
- mode = va_arg(ap, mode_t);
- va_end(ap);
+ if (oflag & O_CREAT) {
+ va_list arg;
+ va_start (arg, oflag);
+ mode = va_arg (arg, mode_t);
+ va_end (arg);
}
- return __syscall_open(file, flags, mode);
+
+ return __syscall_open(file, oflag, mode);
}
libc_hidden_def(__libc_open)
@@ -42,7 +41,8 @@ libc_hidden_proto(open)
weak_alias(__libc_open,open)
libc_hidden_weak(open)
-int creat(const char *file, mode_t mode)
+int __libc_creat(const char *file, mode_t mode)
{
return __libc_open(file, O_WRONLY | O_CREAT | O_TRUNC, mode);
}
+weak_alias(__libc_creat,creat)