summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid McCullough <davidm@snapgear.com>2003-04-29 14:41:48 +0000
committerDavid McCullough <davidm@snapgear.com>2003-04-29 14:41:48 +0000
commit416799ee539e356c3a4bc86485ffb502077ef9fd (patch)
tree6a60a177a4a8626f0c0fcd0a7b2c0296aaa28729
parent2cb53e303f7b61abefada491815f002b591a60b8 (diff)
Fixup __libc_open to use varargs and match the prototype.
On the H8 varargs are rather unusual and if you declare a function with varargs, it had better use them or it won't work.
-rw-r--r--libc/sysdeps/linux/common/syscalls.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c
index ede9fe384..74b2603a9 100644
--- a/libc/sysdeps/linux/common/syscalls.c
+++ b/libc/sysdeps/linux/common/syscalls.c
@@ -80,11 +80,16 @@ weak_alias (__libc_write, __write)
#ifdef L___syscall_open
#define __NR___syscall_open __NR_open
#include <stdarg.h>
-/* Do not include fcntl.h, so gcc doesn't whine the prototype */
+#include <fcntl.h>
static inline
_syscall3(int, __syscall_open, const char *, fn, int, flags, __kernel_mode_t, mode);
-int __libc_open (const char * fn, int flags, mode_t mode)
+int __libc_open (const char * fn, int flags, ...)
{
+ va_list ap;
+ mode_t mode;
+ va_start(ap, flags);
+ mode = va_arg(ap, mode_t);
+ va_end(ap);
return __syscall_open(fn, flags, mode);
}