delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/07/19/17:13:23

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <911C684A29ACD311921800508B7293BA010A8A41@cnmail>
From: Mark Bradshaw <bradshaw AT staff DOT crosswalk DOT com>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Cc: Mark Bradshaw <mark AT networksimplicity DOT com>
Subject: patch to dir.cc
Date: Thu, 19 Jul 2001 15:52:30 -0400
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)

I've track down a problem with the sftp server hanging under Windows NT (not
Windows 2000) to the readdir function in dir.cc.  The sftp server called
readdir with a directory handle repeatedly to get all the directory entries.
When the directory has been fully read it calls readdir one more time with a
(now) invalid handle.  This causes FindNextFileA to never return.  I've add
a small bit of code to check for the invalid handle before called
FindNextFileA, and that seems to have corrected the problem.  The latest cvs
version of dir.cc didn't show any changes to readdir, so I assume this
hasn't been patched yet.

There is code that checks for an invalid handle, but it also checks whether
it's the first time readdir has been called.  This doesn't match the error
condition occurring with the sftp server.  I added a quick check after that
that simply returns res as NULL.  There may be additional things that you
want to add in.

As I noted above, this error only occurs with Windows NT, not 2000, but the
changed code still appears to function normally under Windows 2000.

BTW, any idea when the next version of the cygwin dll will be released?

Mark


----------------------------------------------------------------------------
----

--- /usr/src/cygwin-1.3.2-1/winsup/cygwin/dir.cc        Sat May 12 18:32:40
2001
+++ /tmp/dir.cc Thu Jul 19 14:46:13 2001
@@ -160,6 +160,10 @@ readdir (DIR * dir)
          return res;
        }
     }
+  else if (dir->__d_u.__d_data.__handle == INVALID_HANDLE_VALUE)
+    {
+      return res;
+    }
   else if (!FindNextFileA (dir->__d_u.__d_data.__handle, &buf))
     {
       DWORD lasterr = GetLastError ();

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019