OSDN Git Service

* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Correctly set
authorcgf <cgf>
Mon, 10 Jun 2002 01:25:46 +0000 (01:25 +0000)
committercgf <cgf>
Mon, 10 Jun 2002 01:25:46 +0000 (01:25 +0000)
number of links for directory, if appropriate.

winsup/cygwin/ChangeLog
winsup/cygwin/fhandler_disk_file.cc

index 4178393..89ea5b3 100644 (file)
@@ -1,3 +1,8 @@
+2002-06-09  Christopher Faylor  <cgf@redhat.com>
+
+       * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Correctly
+       set number of links for directory, if appropriate.
+
 2002-06-10  Robert Collins  <rbtcollins@hotmail.com>
 
        * cygwin.din: Add _pthread_cleanup_push and _pthread_cleanup_pop.
 
 2002-04-24  Thomas Pfaff  <tpfaff@gmx.net>
 
-       * include/pthread.h (__pthread_cleanup_handler): New structure
-       (pthread_cleanup_push): Rewritten .
+       * include/pthread.h (__pthread_cleanup_handler): New structure.
+       (pthread_cleanup_push): Rewritten.
        (pthread_cleanup_pop): Ditto.
        (_pthread_cleanup_push): New prototype.
-       (_pthread_cleanup_pop) Ditto.
+       (_pthread_cleanup_pop): Ditto.
 
 2002-04-24  Thomas Pfaff  <tpfaff@gmx.net>
 
        descriptor, except if it already appears in my_grps.
        Use sec_acl() in place of get_dacl().
        (verify_token): Create from code in seteuid(), with tighter checks.
-       (get_dacl) Deleted.
+       (get_dacl): Deleted.
        (get_group_sidlist): Add argument to indicate if pgrpsid is already
        in the groups.
        * security.h: Define verify_token().
index 6852d3f..443612f 100644 (file)
@@ -203,9 +203,14 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc,
   to_timestruc_t (&ftLastAccessTime, &buf->st_atim);
   to_timestruc_t (&ftLastWriteTime, &buf->st_mtim);
   to_timestruc_t (&ftCreationTime, &buf->st_ctim);
-  buf->st_nlink   = nNumberOfLinks;
-  buf->st_dev     = pc->volser ();
-  buf->st_size    = ((__off64_t)nFileSizeHigh << 32) + nFileSizeLow;
+  buf->st_dev = pc->volser ();
+  buf->st_size = ((__off64_t)nFileSizeHigh << 32) + nFileSizeLow;
+  /* Unfortunately the count of 2 confuses `find (1)' command. So
+     let's try it with `1' as link count. */
+  if (pc->isdir () && !pc->isremote () && nNumberOfLinks == 1)
+    buf->st_nlink = num_entries (pc->get_win32 ());
+  else
+    buf->st_nlink = nNumberOfLinks;
 
   /* Assume that if a drive has ACL support it MAY have valid "inodes".
      It definitely does not have valid inodes if it does not have ACL
@@ -307,10 +312,6 @@ fhandler_disk_file::fstat_helper (struct __stat64 *buf, path_conv *pc,
      those subdirectories point to it.
      This is too slow on remote drives, so we do without it and
      set the number of links to 2. */
-  /* Unfortunately the count of 2 confuses `find (1)' command. So
-     let's try it with `1' as link count. */
-  if (pc->isdir () && !buf->st_nlink)
-    buf->st_nlink = pc->isremote () ? 1 : num_entries (pc->get_win32 ());
 
   syscall_printf ("0 = fstat (, %p) st_atime=%x st_size=%D, st_mode=%p, st_ino=%d, sizeof=%d",
                  buf, buf->st_atime, buf->st_size, buf->st_mode,