diff options
| author | Andreas Schneider <asn@samba.org> | 2014-01-29 08:41:15 +0100 |
|---|---|---|
| committer | Andreas Schneider <asn@samba.org> | 2014-01-29 09:55:42 +0100 |
| commit | 81ece3533fa99b48b428870042246fb8dfdf36ad (patch) | |
| tree | dd28fb719e95b3e61c8129d362bbda8a82070110 /src | |
| parent | bb4dd1f1733fe80493e3f165f206df675fb32beb (diff) | |
| download | socket_wrapper-81ece3533fa99b48b428870042246fb8dfdf36ad.tar.gz socket_wrapper-81ece3533fa99b48b428870042246fb8dfdf36ad.tar.xz socket_wrapper-81ece3533fa99b48b428870042246fb8dfdf36ad.zip | |
src: Fix va arg passing in open().
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/socket_wrapper.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index 353a9a5..6e38f32 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -593,11 +593,18 @@ static int libc_listen(int sockfd, int backlog) return swrap.fns.libc_listen(sockfd, backlog); } -static int libc_open(const char *pathname, int flags, mode_t mode) +static int libc_vopen(const char *pathname, int flags, va_list ap) { + long int mode = 0; + int fd; + swrap_load_lib_function(SWRAP_LIBC, open); - return swrap.fns.libc_open(pathname, flags, mode); + mode = va_arg(ap, long int); + + fd = swrap.fns.libc_open(pathname, flags, (mode_t)mode); + + return fd; } static int libc_pipe(int pipefd[2]) @@ -2630,11 +2637,11 @@ int listen(int s, int backlog) * OPEN ***************************************************************************/ -static int swrap_open(const char *pathname, int flags, mode_t mode) +static int swrap_vopen(const char *pathname, int flags, va_list ap) { int ret; - ret = libc_open(pathname, flags, mode); + ret = libc_vopen(pathname, flags, ap); if (ret != -1) { /* * There are methods for closing descriptors (libc-internal code @@ -2649,13 +2656,14 @@ static int swrap_open(const char *pathname, int flags, mode_t mode) int open(const char *pathname, int flags, ...) { - mode_t mode; va_list ap; + int fd; va_start(ap, flags); - mode = va_arg(ap, mode_t); + fd = swrap_vopen(pathname, flags, ap); va_end(ap); - return swrap_open(pathname, flags, mode); + + return fd; } /**************************************************************************** |
