[PATCH] swrap: Use the loaded libc open() directly.
Volker Lendecke
Volker.Lendecke at SerNet.DE
Mon May 5 01:37:19 MDT 2014
Hi!
Andreas' socket wrapper repo contains a ciritical bug fix
that should go into Samba master asap. Attached find the
version that applies to master. Please review & push!
Thanks,
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 6a857c2a10880d8b38e7c0a7caaf9ad86e43fd26 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Mon, 5 May 2014 08:51:10 +0200
Subject: [PATCH] swrap: Use the loaded libc open() directly.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Michael Adam <obnox at samba.org>
---
lib/socket_wrapper/socket_wrapper.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/lib/socket_wrapper/socket_wrapper.c b/lib/socket_wrapper/socket_wrapper.c
index c5b1fdf..a0af90e 100644
--- a/lib/socket_wrapper/socket_wrapper.c
+++ b/lib/socket_wrapper/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;
}
--
1.7.9.5
More information about the samba-technical
mailing list