diff options
| author | Andreas Schneider <asn@samba.org> | 2014-04-25 08:37:37 +0200 |
|---|---|---|
| committer | Andreas Schneider <asn@samba.org> | 2014-04-25 14:27:30 +0200 |
| commit | fb8afa1fb23135a8b7635f3f04d69a6c24626319 (patch) | |
| tree | 0c01e7a683d8adcdd66ceba5f900bfebc0f59c28 /src | |
| parent | 08ffcf57e38ca19d9a7535d61951dbd292f39bdb (diff) | |
| download | socket_wrapper-fb8afa1fb23135a8b7635f3f04d69a6c24626319.tar.gz socket_wrapper-fb8afa1fb23135a8b7635f3f04d69a6c24626319.tar.xz socket_wrapper-fb8afa1fb23135a8b7635f3f04d69a6c24626319.zip | |
swrap: Use the loaded libc open() directly.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/socket_wrapper.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index 5ed9d9f..3b99814 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -608,6 +608,18 @@ static int libc_vopen(const char *pathname, int flags, va_list ap) return fd; } +static int libc_open(const char *pathname, int flags, ...) +{ + va_list ap; + int fd; + + va_start(ap, flags); + fd = libc_vopen(pathname, flags, ap); + va_end(ap); + + return fd; +} + static int libc_pipe(int pipefd[2]) { swrap_load_lib_function(SWRAP_LIBSOCKET, pipe); @@ -1707,7 +1719,7 @@ static int swrap_get_pcap_fd(const char *fname) if (fd != -1) return fd; - fd = open(fname, O_WRONLY|O_CREAT|O_EXCL|O_APPEND, 0644); + fd = libc_open(fname, O_WRONLY|O_CREAT|O_EXCL|O_APPEND, 0644); if (fd != -1) { struct swrap_file_hdr file_hdr; file_hdr.magic = 0xA1B2C3D4; @@ -1725,7 +1737,7 @@ static int swrap_get_pcap_fd(const char *fname) return fd; } - fd = open(fname, O_WRONLY|O_APPEND, 0644); + fd = libc_open(fname, O_WRONLY|O_APPEND, 0644); return fd; } |
