From 245b4053dc63c5e23864fd1a57d595df2a5f06f7 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 30 Aug 2006 17:12:51 +0000 Subject: tweak a few syscalls using varargs --- libc/sysdeps/linux/common/open.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'libc/sysdeps/linux/common/open.c') diff --git a/libc/sysdeps/linux/common/open.c b/libc/sysdeps/linux/common/open.c index 580876a26..1a514e62d 100644 --- a/libc/sysdeps/linux/common/open.c +++ b/libc/sysdeps/linux/common/open.c @@ -22,19 +22,18 @@ static inline _syscall3(int, __syscall_open, const char *, file, int, flags, __kernel_mode_t, mode); libc_hidden_proto(__libc_open) -int __libc_open(const char *file, int flags, ...) +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; - - if (flags & O_CREAT) { - va_list ap; - - va_start(ap, flags); - mode = va_arg(ap, mode_t); - va_end(ap); + mode_t mode = 0; + + 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); } libc_hidden_def(__libc_open) -- cgit v1.2.3