Browse Source

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.
David McCullough 22 years ago
parent
commit
416799ee53
1 changed files with 7 additions and 2 deletions
  1. 7 2
      libc/sysdeps/linux/common/syscalls.c

+ 7 - 2
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);
 }