diff options
author | maximilian attems <max@stro.at> | 2011-03-29 14:48:13 +0200 |
---|---|---|
committer | maximilian attems <max@stro.at> | 2011-03-29 14:48:13 +0200 |
commit | e90552b6d78dd4d090d014024da00723e179df30 (patch) | |
tree | 8d87e242f2976327280bab785ca88b25770e44d2 | |
parent | bd40e25218ea46d0b867e5b8dff4284f26c3854a (diff) | |
download | klibc-e90552b6d78dd4d090d014024da00723e179df30.tar.gz |
Revert "[klibc] Use <stdarg.h> features in open() and openat()"
Issue for i386 and m68k (corrupting stack)
that needs to be fixed for them.
This reverts commit 0b40b7a7f71a773b606369e71fff8a6fbe22dbdf.
-rw-r--r-- | usr/include/fcntl.h | 2 | ||||
-rw-r--r-- | usr/include/unistd.h | 2 | ||||
-rw-r--r-- | usr/klibc/open.c | 14 | ||||
-rw-r--r-- | usr/klibc/openat.c | 14 |
4 files changed, 8 insertions, 24 deletions
diff --git a/usr/include/fcntl.h b/usr/include/fcntl.h index c94b2be371d98..0908e2174d0d5 100644 --- a/usr/include/fcntl.h +++ b/usr/include/fcntl.h @@ -35,8 +35,10 @@ #endif /* This is defined here as well as in <unistd.h> */ +#ifndef _KLIBC_IN_OPEN_C __extern int open(const char *, int, ...); __extern int openat(int, const char *, int, ...); +#endif __extern int creat(const char *, mode_t); __extern int fcntl(int, int, ...); diff --git a/usr/include/unistd.h b/usr/include/unistd.h index 0d3205e1cd08f..97760d4eb4995 100644 --- a/usr/include/unistd.h +++ b/usr/include/unistd.h @@ -82,8 +82,10 @@ __extern int lchown(const char *, uid_t, gid_t); __extern char *getcwd(char *, size_t); /* Also in <fcntl.h> */ +#ifndef _KLIBC_IN_OPEN_C __extern int open(const char *, int, ...); __extern int openat(int, const char *, int, ...); +#endif __extern int creat(const char *, mode_t); __extern int open_cloexec(const char *, int, mode_t); __extern int close(int); diff --git a/usr/klibc/open.c b/usr/klibc/open.c index 290f9590892d6..9b0897a77927a 100644 --- a/usr/klibc/open.c +++ b/usr/klibc/open.c @@ -5,27 +5,17 @@ * system call, to indicate that we're 64-bit safe. */ +#define _KLIBC_IN_OPEN_C #include <unistd.h> #include <fcntl.h> #include <bitsize.h> -#include <stdarg.h> #if _BITSIZE == 32 && !defined(__i386__) extern int __open(const char *, int, mode_t); -int open(const char *pathname, int flags, ...) +int open(const char *pathname, int flags, 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); - } - return __open(pathname, flags | O_LARGEFILE, mode); } diff --git a/usr/klibc/openat.c b/usr/klibc/openat.c index 0609b832c1858..83c87cd49b1f4 100644 --- a/usr/klibc/openat.c +++ b/usr/klibc/openat.c @@ -5,27 +5,17 @@ * system call, to indicate that we're 64-bit safe. */ +#define _KLIBC_IN_OPEN_C #include <unistd.h> #include <fcntl.h> #include <bitsize.h> -#include <stdarg.h> #if _BITSIZE == 32 && !defined(__i386__) && defined(__NR_openat) extern int __openat(int, const char *, int, mode_t); -int openat(int dirfd, const char *pathname, int flags, ...) +int openat(int dirfd, const char *pathname, int flags, 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); - } - return __openat(dirfd, pathname, flags | O_LARGEFILE, mode); } |