summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-01-13 13:50:02 +0000
committerCorinna Vinschen <corinna@vinschen.de>2011-01-13 13:50:02 +0000
commit07c43238cfec7c09207b9cf5460da4c7842755e5 (patch)
tree641eb25a6396bd23d07767603e631f0a201183ff
parentcf8d5ec5ae2fba33e4c667b94db3e2d1467b2299 (diff)
downloadcygnal-07c43238cfec7c09207b9cf5460da4c7842755e5.tar.gz
cygnal-07c43238cfec7c09207b9cf5460da4c7842755e5.tar.bz2
cygnal-07c43238cfec7c09207b9cf5460da4c7842755e5.zip
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Alwasy set
st_size of directories to 0. Explain why.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc9
2 files changed, 13 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 143594395..31281de04 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-13 Corinna Vinschen <corinna@vinschen.de>
+
+ * fhandler_disk_file.cc (fhandler_base::fstat_helper): Alwasy set
+ st_size of directories to 0. Explain why.
+
2011-01-12 Corinna Vinschen <corinna@vinschen.de>
* posix.sgml: Add madvise to BSD list.
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index aea62a1b2..3d72f86b9 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -497,7 +497,14 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
&buf->st_ctim);
to_timestruc_t ((PFILETIME) &pfnoi->CreationTime, &buf->st_birthtim);
buf->st_rdev = buf->st_dev = get_dev ();
- buf->st_size = (_off64_t) pfnoi->EndOfFile.QuadPart;
+ /* CV 2011-01-13: Observations on the Cygwin mailing list point to an
+ interesting behaviour in some Windows versions. Apparently the size of
+ a directory is computed at the time the directory is first scanned. This
+ can result in two subsequent NtQueryInformationFile calls to return size
+ 0 in the first call and size > 0 in the second call. This in turn can
+ affect applications like newer tar.
+ FIXME: Is the allocation size affected as well? */
+ buf->st_size = pc.isdir () ? 0 : (_off64_t) pfnoi->EndOfFile.QuadPart;
/* The number of links to a directory includes the number of subdirectories
in the directory, since all those subdirectories point to it. However,
this is painfully slow, so we do without it. */