From 29ce22c955f7a2cee33e9c465e4e7e0d043671bc Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 2 Feb 2005 09:46:52 +0000 Subject: [PATCH] * times.cc (utimes): Mark st_ctime for update according to SUSv3. --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/times.cc | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 9bea7c38e..c222e9835 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2005-02-02 Corinna Vinschen + + * times.cc (utimes): Mark st_ctime for update according to SUSv3. + 2005-02-01 Christopher Faylor * fhandler_proc.cc (format_proc_partitions): Remove PartitionType check diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index a6fac1a05..4cdb4b26c 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -1,6 +1,7 @@ /* times.cc - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Red Hat, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005 Red Hat, Inc. This file is part of Cygwin. @@ -483,18 +484,21 @@ utimes (const char *path, struct timeval *tvp) } else { + gettimeofday (&tmp[0], 0); if (tvp == 0) { - gettimeofday (&tmp[0], 0); tmp[1] = tmp[0]; tvp = tmp; } FILETIME lastaccess; FILETIME lastwrite; + FILETIME lastchange; timeval_to_filetime (tvp + 0, &lastaccess); timeval_to_filetime (tvp + 1, &lastwrite); + /* Mark st_ctime for update */ + timeval_to_filetime (tmp + 0, &lastchange); debug_printf ("incoming lastaccess %08x %08x", tvp->tv_sec, @@ -507,7 +511,7 @@ utimes (const char *path, struct timeval *tvp) on the file whose time is being modified. So calls to utime() fail for read only files. */ - if (!SetFileTime (h, 0, &lastaccess, &lastwrite)) + if (!SetFileTime (h, &lastchange, &lastaccess, &lastwrite)) { __seterrno (); res = -1;