Fix test for invalid handle in w32.c's 'utime'.

src/w32.c (utime): Test for INVALID_HANDLE_VALUE, not for NULL, to
 see whether CreateFile failed.
This commit is contained in:
Eli Zaretskii 2012-10-04 22:07:45 +02:00
parent 0e2ae83d4b
commit 7604f29862
2 changed files with 6 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2012-10-04 Eli Zaretskii <eliz@gnu.org>
* w32.c (utime): Test for INVALID_HANDLE_VALUE, not for NULL, to
see whether CreateFile failed.
2012-10-04 Paul Eggert <eggert@cs.ucla.edu>
* profiler.c (handle_profiler_signal): Inhibit pending signals too,

View file

@ -3954,7 +3954,7 @@ utime (const char *name, struct utimbuf *times)
/* Need write access to set times. */
fh = CreateFile (name, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
0, OPEN_EXISTING, 0, NULL);
if (fh)
if (fh != INVALID_HANDLE_VALUE)
{
convert_from_time_t (times->actime, &atime);
convert_from_time_t (times->modtime, &mtime);