[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: nfs: on Windows Fixed consts translation for Windows XP
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon Aug 17 05:39:39 UTC 2026
Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC
Commits:
23990dd6 by Jay Pitts at 2026-08-17T06:24:21+02:00
nfs: on Windows Fixed consts translation for Windows XP
- - - - -
8866e580 by Jay Pitts at 2026-08-17T06:24:50+02:00
nfs: on Windows Added patch to libnfs
(cherry picked from commit af2fa44599887c79e86c9e74f57e53fb45e0b530)
- - - - -
3 changed files:
- + contrib/src/nfs/0009-win32-stop-read-loop-when-transport-replaced.patch
- contrib/src/nfs/rules.mak
- modules/access/nfs.c
Changes:
=====================================
contrib/src/nfs/0009-win32-stop-read-loop-when-transport-replaced.patch
=====================================
@@ -0,0 +1,51 @@
+From 6680b11bbf4516c5718d14eaf3468f4d91cbdefd Tue Aug 04 11:45:11 2026
+From: jaypitts23 <jayalanpitts at gmail.com>
+Date: Tue, 04 Aug 2026 11:45:11 +0000
+Subject: [PATCH] win32: stop rpc_read_from_socket() when the transport is
+ replaced mid-read
+
+---
+ lib/socket.c | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+--- a/lib/socket.c 2026-07-26 13:31:24.953045209 +0000
++++ b/lib/socket.c 2026-07-26 13:31:57.107691689 +0000
+@@ -555,6 +555,16 @@
+ ssize_t count;
+ int pos;
+ uint32_t inbuf_size;
++ /* A reply callback (e.g. the portmap GETPORT handler) can disconnect
++ * the socket we are reading on and open a new connection while we are
++ * still inside this read loop. If the loop then iterates and calls
++ * recv() on the freshly created, not-yet-connected socket, Windows
++ * returns WSAENOTCONN (not mapped to EAGAIN), which is treated as a
++ * fatal read error and aborts the mount. Snapshot the transport and,
++ * once a PDU callback has replaced it, stop reading and let the next
++ * mainloop iteration service the new socket. */
++ int saved_fd = rpc->fd;
++ int saved_is_connected = rpc->is_connected;
+
+ assert(rpc->magic == RPC_CONTEXT_MAGIC);
+ if (rpc->socket_disabled) {
+@@ -841,6 +851,17 @@
+ "Closing socket");
+ return -1;
+ }
++ /* The PDU callback replaced the transport
++ * (fd changed and/or is_connected dropped to
++ * 0); stop reading the now-stale connection.
++ * Checking is_connected too avoids missing the
++ * case where Windows recycles the fd number. */
++ if (rpc->fd != saved_fd ||
++ rpc->is_connected != saved_is_connected) {
++ rpc->inpos = 0;
++ rpc->state = READ_RM;
++ return 0;
++ }
+ #ifdef HAVE_LIBKRB5
+ /*
+ * Since we don't do zero-copy reads for
+
+--
+2.39.2
+
=====================================
contrib/src/nfs/rules.mak
=====================================
@@ -29,6 +29,7 @@ nfs: libnfs-$(NFS_VERSION).tar.gz .sum-nfs
$(APPLY) $(SRC)/nfs/0001-cmake-export-the-necessary-library-in-the-pkg-config.patch
$(APPLY) $(SRC)/nfs/0007-tls-add-support-for-kernel-without-TLS_1_3_VERSION.patch
$(APPLY) $(SRC)/nfs/0008-tls-define-TLS_RX-if-it-s-missing.patch
+ $(APPLY) $(SRC)/nfs/0009-win32-stop-read-loop-when-transport-replaced.patch
$(MOVE)
.nfs: nfs toolchain.cmake
=====================================
modules/access/nfs.c
=====================================
@@ -136,7 +136,18 @@ vlc_rpc_mainloop(stream_t *p_access, struct rpc_context *p_rpc_ctx,
struct pollfd p_fds[1];
int i_ret;
p_fds[0].fd = rpc_get_fd(p_rpc_ctx);
+
+#if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0600)
+ const short nfs_events = rpc_which_events(p_rpc_ctx);
+ short local_events = 0;
+ if (nfs_events & 0x0001) /* libnfs POLLIN */
+ local_events |= POLLIN;
+ if (nfs_events & 0x0004) /* libnfs POLLOUT */
+ local_events |= POLLOUT;
+ p_fds[0].events = local_events;
+#else
p_fds[0].events = rpc_which_events(p_rpc_ctx);
+#endif
if ((i_ret = vlc_poll_i11e(p_fds, 1, -1)) < 0)
{
@@ -146,11 +157,38 @@ vlc_rpc_mainloop(stream_t *p_access, struct rpc_context *p_rpc_ctx,
msg_Err(p_access, "vlc_poll_i11e failed");
p_sys->b_error = true;
}
- else if (i_ret > 0 && p_fds[0].revents
- && rpc_service(p_rpc_ctx, p_fds[0].revents) < 0)
+ else if (i_ret > 0 && p_fds[0].revents)
{
- msg_Err(p_access, "nfs_service failed");
- p_sys->b_error = true;
+#if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0600)
+ short rv = p_fds[0].revents;
+ short nfs_revents = 0;
+ if (rv & POLLIN)
+ nfs_revents |= 0x0001; /* libnfs POLLIN */
+ if (rv & POLLOUT)
+ nfs_revents |= 0x0004; /* libnfs POLLOUT */
+ if (rv & (POLLERR | POLLHUP))
+ {
+ int soerr = 0;
+ int soerr_len = sizeof (soerr);
+ if (getsockopt(p_fds[0].fd, SOL_SOCKET, SO_ERROR,
+ (char *)&soerr, &soerr_len) == 0 && soerr == 0)
+ {
+ if (rv & POLLOUT)
+ nfs_revents |= 0x0004; /* libnfs POLLOUT */
+ }
+ else
+ nfs_revents |= 0x0008; /* libnfs POLLERR */
+ }
+#else
+ int nfs_revents = p_fds[0].revents;
+#endif
+
+ if (nfs_revents != 0
+ && rpc_service(p_rpc_ctx, nfs_revents) < 0)
+ {
+ msg_Err(p_access, "nfs_service failed");
+ p_sys->b_error = true;
+ }
}
}
return p_sys->b_error ? -1 : 0;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/23aa6c634c4a62bc6ddc77b1cad5a825f51b19d6...8866e5804e83dc4636b76b7a1a5e3bc91cb4e85c
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/23aa6c634c4a62bc6ddc77b1cad5a825f51b19d6...8866e5804e83dc4636b76b7a1a5e3bc91cb4e85c
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list