[vlc-commits] [Git][videolan/vlc][master] nfs:// on Windows: Added patch to libnfs

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Aug 9 16:04:54 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
af2fa445 by Jay Pitts at 2026-08-09T15:29:48+00:00
nfs:// on Windows: Added patch to libnfs

- - - - -


2 changed files:

- + contrib/src/nfs/0009-win32-stop-read-loop-when-transport-replaced.patch
- contrib/src/nfs/rules.mak


Changes:

=====================================
contrib/src/nfs/0009-win32-stop-read-loop-when-transport-replaced.patch
=====================================
@@ -0,0 +1,50 @@
+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



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/af2fa44599887c79e86c9e74f57e53fb45e0b530

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/af2fa44599887c79e86c9e74f57e53fb45e0b530
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