swrap: Make sure we do not redirect (f)open(at)() or fcntl()
authorAndreas Schneider <asn@samba.org>
Tue, 27 Jun 2023 10:18:53 +0000 (12:18 +0200)
committerAndreas Schneider <asn@samba.org>
Wed, 28 Jun 2023 11:35:00 +0000 (13:35 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
src/socket_wrapper.c

index dc07b53fcd0ce2c79b00cf4cfbb5dcc59d5ad6e0..addad4ca8e141ffd5b70005f2ce65d15b7aed4f6 100644 (file)
 
 #include "config.h"
 
+/*
+ * Make sure we do not redirect (f)open(at)() or fcntl() to their 64bit
+ * variants
+ */
+#undef _FILE_OFFSET_BITS
+
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/stat.h>
 
 #include "socket_wrapper.h"
 
+#ifdef __USE_FILE_OFFSET64
+#error -D_FILE_OFFSET_BITS=64 should not be set for socket_wrapper!
+#endif
+
 enum swrap_dbglvl_e {
        SWRAP_LOG_ERROR = 0,
        SWRAP_LOG_WARN,
@@ -4625,6 +4635,7 @@ static FILE *swrap_fopen(const char *name, const char *mode)
        return fp;
 }
 
+#undef fopen /* Needed for LFS handling */
 FILE *fopen(const char *name, const char *mode)
 {
        return swrap_fopen(name, mode);
@@ -4676,6 +4687,7 @@ static int swrap_vopen(const char *pathname, int flags, va_list ap)
        return ret;
 }
 
+#undef open /* Needed for LFS handling */
 int open(const char *pathname, int flags, ...)
 {
        va_list ap;
@@ -4781,6 +4793,7 @@ static int swrap_vopenat(int dirfd, const char *path, int flags, va_list ap)
        return ret;
 }
 
+#undef openat /* Needed for LFS handling */
 int openat(int dirfd, const char *path, int flags, ...)
 {
        va_list ap;
@@ -8505,6 +8518,7 @@ static int swrap_vfcntl(int fd, int cmd, va_list va)
        return rc;
 }
 
+#undef fcntl /* Needed for LFS handling */
 int fcntl(int fd, int cmd, ...)
 {
        va_list va;