mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 12:29:32 +08:00
* 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.
This commit is contained in:
parent
ac0ac6534d
commit
7158264315
@ -1,3 +1,12 @@
|
||||
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
|
||||
|
@ -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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user