[vlc-devel] [PATCH 3.0] smb2: fix build with libsmb2 3.0.0

Thomas Guillem thomas at gllm.fr
Fri Apr 30 13:12:09 UTC 2021


Fixes #25680
---
 modules/access/smb2.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/modules/access/smb2.c b/modules/access/smb2.c
index 6575de42d2..7d44854655 100644
--- a/modules/access/smb2.c
+++ b/modules/access/smb2.c
@@ -133,6 +133,34 @@ smb2_set_error(stream_t *access, const char *psz_func, int err)
 
 #define VLC_SMB2_STATUS_DENIED(x) (x == -ECONNREFUSED || x == -EACCES)
 
+#if defined (__ELF__) || defined (__MACH__) /* weak support */
+/* There is no way to know if libsmb2 has these new symbols and we don't want
+ * to increase the version requirement on VLC 3.0, therefore implement a weak
+ * compat version. */
+const t_socket *
+smb2_get_fds(struct smb2_context *smb2, size_t *fd_count, int *timeout);
+int
+smb2_service_fd(struct smb2_context *smb2, int fd, int revents);
+
+__attribute__((weak)) const t_socket *
+smb2_get_fds(struct smb2_context *smb2, size_t *fd_count, int *timeout)
+{
+    (void) timeout;
+    static thread_local t_socket fd;
+
+    *fd_count = 1;
+    fd = smb2_get_fd(smb2);
+    return &fd;
+}
+
+__attribute__((weak)) int
+smb2_service_fd(struct smb2_context *smb2, int fd, int revents)
+{
+    (void) fd;
+    return smb2_service(smb2, revents);
+}
+#endif
+
 static int
 vlc_smb2_mainloop(stream_t *access, bool teardown)
 {
-- 
2.30.0



More information about the vlc-devel mailing list