Revision | 162e01e2e7b2b80711ea4701444f083732861ecf (tree) |
---|---|
Time | 2016-01-04 21:47:29 |
Author | Yoshinori Sato <ysato@user...> |
Commiter | Yoshinori Sato |
openat argument fix.
If argument passing to register case (ex. -mregparam=3).
This case set all parameters set to register from caller.
But callee refer to stack. So can't get parameter.
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
@@ -8,11 +8,24 @@ | ||
8 | 8 | |
9 | 9 | #include <sys/syscall.h> |
10 | 10 | #include <fcntl.h> |
11 | +#include <stdarg.h> | |
11 | 12 | |
12 | 13 | #ifdef __NR_openat |
13 | 14 | # define __NR___syscall_openat __NR_openat |
14 | 15 | static __inline__ _syscall4(int, __syscall_openat, int, fd, const char *, file, int, oflag, mode_t, mode) |
15 | -strong_alias_untyped(__syscall_openat,openat) | |
16 | + | |
17 | +int __openat(int fd, const char *file, int o_flag, ...) | |
18 | +{ | |
19 | + va_list ap; | |
20 | + mode_t mode; | |
21 | + | |
22 | + va_start(ap, o_flag); | |
23 | + mode = va_arg(ap, int); | |
24 | + va_end(ap); | |
25 | + return __syscall_openat(fd, file, o_flag, mode); | |
26 | +} | |
27 | + | |
28 | +strong_alias_untyped(__openat,openat) | |
16 | 29 | libc_hidden_def(openat) |
17 | 30 | #else |
18 | 31 | /* should add emulation with open() and /proc/self/fd/ ... */ |