aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2017-04-06 09:05:26 +0200
committerAndreas Schneider <asn@samba.org>2017-04-06 09:18:30 +0200
commit908834465e11736796e418dfdee6425f71959590 (patch)
treec50b721cb179d9ec237bb81984fce63e82b9cf78 /src
parentfb810a68eae6cb369d799805d3f0cd529f6d893c (diff)
downloadsocket_wrapper-908834465e11736796e418dfdee6425f71959590.tar.gz
socket_wrapper-908834465e11736796e418dfdee6425f71959590.tar.xz
socket_wrapper-908834465e11736796e418dfdee6425f71959590.zip
swrap: Add fopen64() on systems which provide it
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'src')
-rw-r--r--src/socket_wrapper.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index b22bd2f..395d0d7 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -421,6 +421,9 @@ typedef int (*__libc_dup)(int fd);
typedef int (*__libc_dup2)(int oldfd, int newfd);
typedef int (*__libc_fcntl)(int fd, int cmd, ...);
typedef FILE *(*__libc_fopen)(const char *name, const char *mode);
+#ifdef HAVE_FOPEN64
+typedef FILE *(*__libc_fopen64)(const char *name, const char *mode);
+#endif
#ifdef HAVE_EVENTFD
typedef int (*__libc_eventfd)(int count, int flags);
#endif
@@ -496,6 +499,9 @@ struct swrap_libc_symbols {
SWRAP_SYMBOL_ENTRY(dup2);
SWRAP_SYMBOL_ENTRY(fcntl);
SWRAP_SYMBOL_ENTRY(fopen);
+#ifdef HAVE_FOPEN64
+ SWRAP_SYMBOL_ENTRY(fopen64);
+#endif
#ifdef HAVE_EVENTFD
SWRAP_SYMBOL_ENTRY(eventfd);
#endif
@@ -858,6 +864,15 @@ static FILE *libc_fopen(const char *name, const char *mode)
return swrap.libc.symbols._libc_fopen.f(name, mode);
}
+#ifdef HAVE_FOPEN64
+static FILE *libc_fopen64(const char *name, const char *mode)
+{
+ swrap_bind_symbol_libc(fopen64);
+
+ return swrap.libc.symbols._libc_fopen64.f(name, mode);
+}
+#endif /* HAVE_FOPEN64 */
+
static int libc_vopen(const char *pathname, int flags, va_list ap)
{
long int mode = 0;
@@ -3598,6 +3613,31 @@ FILE *fopen(const char *name, const char *mode)
}
/****************************************************************************
+ * FOPEN64
+ ***************************************************************************/
+
+#ifdef HAVE_FOPEN64
+static FILE *swrap_fopen64(const char *name, const char *mode)
+{
+ FILE *fp;
+
+ fp = libc_fopen64(name, mode);
+ if (fp != NULL) {
+ int fd = fileno(fp);
+
+ swrap_remove_stale(fd);
+ }
+
+ return fp;
+}
+
+FILE *fopen64(const char *name, const char *mode)
+{
+ return swrap_fopen64(name, mode);
+}
+#endif /* HAVE_FOPEN64 */
+
+/****************************************************************************
* OPEN
***************************************************************************/