diff options
author | Stefan Metzmacher <metze@samba.org> | 2022-11-23 12:14:12 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2022-11-24 11:01:37 +0000 |
commit | 838f62078795150bb7ec9ec1b4690a1d6a8991ae (patch) | |
tree | 5c9db880a96e8bf307a48dd4027638bb83953bdb /third_party | |
parent | 6dddb268df08fd91f8e0f189f948ad76e5805dca (diff) | |
download | samba-838f62078795150bb7ec9ec1b4690a1d6a8991ae.tar.gz |
third_party: Update socket_wrapper to version 1.3.5
This injects O_LARGEFILE as needed.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/socket_wrapper/socket_wrapper.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/third_party/socket_wrapper/socket_wrapper.c b/third_party/socket_wrapper/socket_wrapper.c index 5804e936ff7..bedda07a72b 100644 --- a/third_party/socket_wrapper/socket_wrapper.c +++ b/third_party/socket_wrapper/socket_wrapper.c @@ -984,6 +984,19 @@ static FILE *libc_fopen64(const char *name, const char *mode) } #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; @@ -991,6 +1004,8 @@ static int libc_vopen(const char *pathname, int flags, va_list ap) swrap_bind_symbol_all(); + swrap_inject_o_largefile(&flags); + if (flags & O_CREAT) { mode = va_arg(ap, int); } @@ -1019,6 +1034,8 @@ static int libc_vopen64(const char *pathname, int flags, va_list ap) swrap_bind_symbol_all(); + swrap_inject_o_largefile(&flags); + if (flags & O_CREAT) { mode = va_arg(ap, int); } @@ -1035,6 +1052,8 @@ static int libc_vopenat(int dirfd, const char *path, int flags, va_list ap) swrap_bind_symbol_all(); + swrap_inject_o_largefile(&flags); + if (flags & O_CREAT) { mode = va_arg(ap, int); } @@ -5325,7 +5344,7 @@ union __swrap_cmsghdr { struct cmsghdr *cmsg; }; -static int swrap_sendmsg_unix_scm_rights(const struct cmsghdr *cmsg, +static int swrap_sendmsg_unix_scm_rights(struct cmsghdr *cmsg, uint8_t **cm_data, size_t *cm_data_space, int *scm_rights_pipe_fd) @@ -5557,7 +5576,7 @@ static int swrap_sendmsg_unix_scm_rights(const struct cmsghdr *cmsg, return 0; } -static int swrap_sendmsg_unix_sol_socket(const struct cmsghdr *cmsg, +static int swrap_sendmsg_unix_sol_socket(struct cmsghdr *cmsg, uint8_t **cm_data, size_t *cm_data_space, int *scm_rights_pipe_fd) @@ -5581,7 +5600,7 @@ static int swrap_sendmsg_unix_sol_socket(const struct cmsghdr *cmsg, return rc; } -static int swrap_recvmsg_unix_scm_rights(const struct cmsghdr *cmsg, +static int swrap_recvmsg_unix_scm_rights(struct cmsghdr *cmsg, uint8_t **cm_data, size_t *cm_data_space) { @@ -5860,7 +5879,7 @@ static int swrap_recvmsg_unix_scm_rights(const struct cmsghdr *cmsg, return 0; } -static int swrap_recvmsg_unix_sol_socket(const struct cmsghdr *cmsg, +static int swrap_recvmsg_unix_sol_socket(struct cmsghdr *cmsg, uint8_t **cm_data, size_t *cm_data_space) { @@ -7831,10 +7850,18 @@ void swrap_destructor(void) SAFE_FREE(sockets); - if (swrap.libc.handle != NULL) { + if (swrap.libc.handle != NULL +#ifdef RTLD_NEXT + && swrap.libc.handle != RTLD_NEXT +#endif + ) { dlclose(swrap.libc.handle); } - if (swrap.libc.socket_handle) { + if (swrap.libc.socket_handle +#ifdef RTLD_NEXT + && swrap.libc.socket_handle != RTLD_NEXT +#endif + ) { dlclose(swrap.libc.socket_handle); } } |