OSDN Git Service

* times.cc (utimes): Only consider fds opened with write access.
authorcgf <cgf>
Wed, 19 Oct 2005 17:11:24 +0000 (17:11 +0000)
committercgf <cgf>
Wed, 19 Oct 2005 17:11:24 +0000 (17:11 +0000)
winsup/cygwin/ChangeLog
winsup/cygwin/times.cc

index 2314db3..27da343 100644 (file)
@@ -1,5 +1,9 @@
 2005-10-19  Christopher Faylor  <cgf@timesys.com>
 
+       * times.cc (utimes): Only consider fds opened with write access.
+
+2005-10-19  Christopher Faylor  <cgf@timesys.com>
+
        * fhandler_disk_file.cc (fhandler_base::utimes_fs): Use existing handle
        if fhandler has one.
        * times.cc (utimes): Scan open fds for matching paths and use existing
index cc4de97..e4bcb8c 100644 (file)
@@ -452,7 +452,8 @@ utimes (const char *path, const struct timeval *tvp)
 
   cygheap_fdenum cfd;
   while (cfd.next () >= 0)
-    if (strcmp (cfd->get_win32_name (), win32) == 0)
+    if (cfd->get_access () & (FILE_WRITE_ATTRIBUTES | GENERIC_WRITE)
+       && strcmp (cfd->get_win32_name (), win32) == 0)
       {
        fh = cfd;
        fromfd = true;