From: cgf AT cygnus DOT com (Christopher Faylor) Subject: Re: patch to winsup981020: link count for directories 24 Oct 1998 18:39:18 -0700 Message-ID: <19981024211842.B974.cygnus.cygwin32.developers@cygnus.com> References: <3632055C DOT 5E5F2115 AT cityweb DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: Corinna Vinschen , cygwin32-developers AT cygnus DOT com On Sat, Oct 24, 1998 at 06:50:36PM +0200, Corinna Vinschen wrote: >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; I can't believe that no one has noticed this before! Applied. cgf