On 32bit systems this is normally done by glibc if _FILE_OFFSET_BITS is 64,
but with socket wrapper we don't want to define _FILE_OFFSET_BITS=64,
as we need to overload open64 explicitly. But we need to inject
O_LARGEFILE for being transparent to the application.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15251
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
}
#endif /* HAVE_FOPEN64 */
+static void swrap_inject_o_largefile(int *flags)
+{
+ (void)*flags; /* maybe unused */
+#if SIZE_MAX == 0xffffffffUL && defined(O_LARGEFILE)
+#ifdef O_PATH
+ if (((*flags) & O_PATH) == 0)
+#endif
+ {
+ *flags |= O_LARGEFILE;
+ }
+#endif
+}
+
static int libc_vopen(const char *pathname, int flags, va_list ap)
{
int mode = 0;
swrap_bind_symbol_all();
+ swrap_inject_o_largefile(&flags);
+
if (flags & O_CREAT) {
mode = va_arg(ap, int);
}
swrap_bind_symbol_all();
+ swrap_inject_o_largefile(&flags);
+
if (flags & O_CREAT) {
mode = va_arg(ap, int);
}
swrap_bind_symbol_all();
+ swrap_inject_o_largefile(&flags);
+
if (flags & O_CREAT) {
mode = va_arg(ap, int);
}