summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/fhandler.cc6
-rw-r--r--winsup/cygwin/times.cc5
3 files changed, 16 insertions, 0 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 075960f0d..8bd756453 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2000-10-20 DJ Delorie <dj@redhat.com>
+
+ * times.cc (to_time_t): pass zero time as epoch
+ * fhandler.cc (fstat): copy atime/ctime from mtime if they're zero
+
Thu Oct 19 23:31:41 2000 Christopher Faylor <cgf@cygnus.com>
* external.cc (fillout_pinfo): Pass PID_NOREDIR flag to pinfo init to
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index f6ce3adf9..1a7835d60 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -855,6 +855,12 @@ fhandler_disk_file::fstat (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];
diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc
index bff40b612..9960f700b 100644
--- a/winsup/cygwin/times.cc
+++ b/winsup/cygwin/times.cc
@@ -221,6 +221,11 @@ to_time_t (FILETIME *ptr)
long rem;
long long x = ((long long) ptr->dwHighDateTime << 32) + ((unsigned)ptr->dwLowDateTime);
+
+ /* pass "no time" as epoch */
+ if (x == 0)
+ return 0;
+
x -= FACTOR; /* number of 100ns between 1601 and 1970 */
rem = x % ((long long)NSPERSEC);
rem += (NSPERSEC / 2);