-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 10/7/2009 9:04 PM:
> I haven't spent time trying to locate where the leak is happening, but
> process explorer confirms that this STC leaves a handle open to the file,
> preventing further re-creation of a new file by the same name.

Found it.  OK to apply?  In case it wasn't obvious, the leak only happens
on invalid timestamps; this was from a gnulib test validating that
1000000000 is rejected with EINVAL.

2009-10-08  Eric Blake  <[email protected]>

        * fhandler_disk_file.cc (utimens_fs): Plug leak for EINVAL.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrNWc8ACgkQ84KuGfSFAYAnBgCfQqJPnnxb6sustsi4rISH35km
CCsAoJpr9V8YcWPn7ijsQzPmeuM9Sl2g
=Q+ks
-----END PGP SIGNATURE-----
diff --git a/winsup/cygwin/fhandler_disk_file.cc 
b/winsup/cygwin/fhandler_disk_file.cc
index 99bbf8b..1e6a781 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -1310,6 +1310,8 @@ fhandler_base::utimens_fs (const struct timespec *tvp)
       if ((tvp[0].tv_nsec < UTIME_NOW || tvp[0].tv_nsec > 999999999L)
          || (tvp[1].tv_nsec < UTIME_NOW || tvp[1].tv_nsec > 999999999L))
        {
+         if (closeit)
+           close_fs ();
          set_errno (EINVAL);
          return -1;
        }

Reply via email to