delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/10/24/10:05:21

From: corinna DOT vinschen AT cityweb DOT de (Corinna Vinschen)
Subject: patch to winsup981020: link count for directories
24 Oct 1998 10:05:21 -0700 :
Message-ID: <3632055C.5E5F2115.cygnus.cygwin32.developers@cityweb.de>
Mime-Version: 1.0
To: cygwin32-developers AT cygnus DOT com

In syscalls.cc the function `num_entries()' is only used,
to count links to directories. Unfortunately, the link
count is made from a count of _all_ entries in the
directory. If this function would count only the entries,
which are also directories, the link count would be
correct. This leads to the following patch.

Regards,
Corinna

--- syscalls.cc.orig    Fri Oct 23 09:39:59 1998
+++ syscalls.cc Sat Oct 24 17:22:59 1998
@@ -1172,7 +1172,8 @@ num_entries (const char *win32_name)
   count ++;
   while (FindNextFileA (handle, &buf))
     {
-      count ++;
+      if ((buf.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
+        count ++;
     }
   FindClose (handle);
   return count;

- Raw text -


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