https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7aae9f323a9f86d20565ae6310c1133df5470729

commit 7aae9f323a9f86d20565ae6310c1133df5470729
Author:     Corinna Vinschen <[email protected]>
AuthorDate: Mon Feb 24 16:52:27 2025 +0100
Commit:     Corinna Vinschen <[email protected]>
CommitDate: Mon Feb 24 16:52:27 2025 +0100

    Cygwin: fhandler_netdrive: use correct thread names
    
    Fix the cygthread names used for debugging when calling the
    thread_netdrive_wnet thread, so they actually show the provider
    getting enumerated.
    
    Fixes: 7db1c6fc4e2a ("Cygwin: //server: revert to using WNet and support 
NFS shares")
    Signed-off-by: Corinna Vinschen <[email protected]>

Diff:
---
 winsup/cygwin/fhandler/netdrive.cc | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/winsup/cygwin/fhandler/netdrive.cc 
b/winsup/cygwin/fhandler/netdrive.cc
index 5d7621649a26..6b4535fff409 100644
--- a/winsup/cygwin/fhandler/netdrive.cc
+++ b/winsup/cygwin/fhandler/netdrive.cc
@@ -370,6 +370,7 @@ create_thread_and_wait (DIR *dir)
 {
   netdriveinf ndi = { dir, 0, 0, NULL };
   cygthread *thr;
+  const char *thread_name = NULL;
 
   /* For the Network root, fetch WSD info. */
   if (strlen (dir->__d_dirname) == 2)
@@ -416,20 +417,30 @@ create_thread_and_wait (DIR *dir)
      ERROR_BAD_NET_NAME (67).  Therefore, short-circuit WebDAV here for
      the time being. */
   if (!strcmp (dir->__d_dirname + 2, TERMSRV_DIR))
-    ndi.provider = WNNC_NET_TERMSRV;
+    {
+      ndi.provider = WNNC_NET_TERMSRV;
+      thread_name = "netdrive_termsrv";
+    }
   else if (!strcmp (dir->__d_dirname + 2, PLAN9_DIR))
-    ndi.provider = WNNC_NET_9P;
+    {
+      ndi.provider = WNNC_NET_9P;
+      thread_name = "netdrive_9p";
+    }
   else if (strchr (dir->__d_dirname + 2, '@') != NULL)
     {
       /* ndi.provider = WNNC_NET_DAV; */
+      /* thread_name = "netdrive_dav"; */
       ndi.err = 0;
       goto out;
     }
   else
-    ndi.provider = WNNC_NET_SMB;
+    {
+      ndi.provider = WNNC_NET_SMB;
+      thread_name = "netdrive_smb";
+    }
 
   ndi.sem = CreateSemaphore (&sec_none_nih, 0, 2, NULL);
-  thr = new cygthread (thread_netdrive_wnet, &ndi, "netdrive_smb");
+  thr = new cygthread (thread_netdrive_wnet, &ndi, thread_name);
   if (thr->detach (ndi.sem))
     ndi.err = EINTR;
   CloseHandle (ndi.sem);

Reply via email to