Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2001-11-15 00:47:41 +0300
committerCorinna Vinschen <corinna@vinschen.de>2001-11-15 00:47:41 +0300
commit71582643154db08638ba549a389d2dec6eb7c790 (patch)
tree9679d1e9ad65266ccf40777054e4065d38eabd84
parentac0ac6534db6d4a4ed7166701a2cc33f091fc49c (diff)
* fhandler.cc (fhandler_disk_file::fstat): Add setting access time
and creation time to last modification time for files on filesystems not supporting multiple timestamps. (fhandler_disk_file::fstat_helper): Set access time and creation time in incoming Windows structure instead of in stat buf to avoid incorrectly overwriting Epoch timestamp.
-rw-r--r--winsup/cygwin/ChangeLog9
-rw-r--r--winsup/cygwin/fhandler.cc22
2 files changed, 25 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 7a6b73ff4..61a68933b 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,14 @@
2001-11-14 Corinna Vinschen <corinna@vinschen.de>
+ * fhandler.cc (fhandler_disk_file::fstat): Add setting access time
+ and creation time to last modification time for files on filesystems
+ not supporting multiple timestamps.
+ (fhandler_disk_file::fstat_helper): Set access time and creation
+ time in incoming Windows structure instead of in stat buf to avoid
+ incorrectly overwriting Epoch timestamp.
+
+2001-11-14 Corinna Vinschen <corinna@vinschen.de>
+
* winsup.h: Remove alloca definition since it's now defined through
inclusion of stdlib.h.
* lib/cygwin_crt0.c: Ditto.
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 9a177bd6e..7ccf0dde3 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -1001,6 +1001,14 @@ fhandler_disk_file::fstat (struct stat *buf, path_conv *pc)
if ((handle = FindFirstFile (pc->get_win32 (), &wfd))
!= INVALID_HANDLE_VALUE)
{
+ /* This is for FAT filesystems, which don't support atime/ctime */
+ if (wfd.ftLastAccessTime.dwLowDateTime == 0
+ && wfd.ftLastAccessTime.dwHighDateTime == 0)
+ wfd.ftLastAccessTime = wfd.ftLastWriteTime;
+ if (wfd.ftCreationTime.dwLowDateTime == 0
+ && wfd.ftCreationTime.dwHighDateTime == 0)
+ wfd.ftCreationTime = wfd.ftLastWriteTime;
+
buf->st_atime = to_time_t (&wfd.ftLastAccessTime);
buf->st_mtime = to_time_t (&wfd.ftLastWriteTime);
buf->st_ctime = to_time_t (&wfd.ftCreationTime);
@@ -1062,6 +1070,14 @@ fhandler_disk_file::fstat_helper (struct stat *buf)
return -1;
}
+ /* This is for FAT filesystems, which don't support atime/ctime */
+ if (local.ftLastAccessTime.dwLowDateTime == 0
+ && local.ftLastAccessTime.dwHighDateTime == 0)
+ local.ftLastAccessTime = local.ftLastWriteTime;
+ if (local.ftCreationTime.dwLowDateTime == 0
+ && local.ftCreationTime.dwHighDateTime == 0)
+ local.ftCreationTime = local.ftLastWriteTime;
+
buf->st_atime = to_time_t (&local.ftLastAccessTime);
buf->st_mtime = to_time_t (&local.ftLastWriteTime);
buf->st_ctime = to_time_t (&local.ftCreationTime);
@@ -1069,12 +1085,6 @@ fhandler_disk_file::fstat_helper (struct stat *buf)
buf->st_dev = local.dwVolumeSerialNumber;
buf->st_size = local.nFileSizeLow;
- /* This is for FAT filesystems, which don't support atime/ctime */
- if (buf->st_atime == 0)
- buf->st_atime = buf->st_mtime;
- if (buf->st_ctime == 0)
- buf->st_ctime = buf->st_mtime;
-
/* Allocate some place to determine the root directory. Need to allocate
enough so that rootdir can add a trailing slash if path starts with \\. */
char root[strlen (get_win32_name ()) + 3];