From 7604f29862ce57d9941ecc4813f9d9e2a09460c4 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 4 Oct 2012 22:07:45 +0200 Subject: [PATCH] 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. --- src/ChangeLog | 5 +++++ src/w32.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9790ff7d0d1..85a4c829063 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-10-04 Eli Zaretskii + + * w32.c (utime): Test for INVALID_HANDLE_VALUE, not for NULL, to + see whether CreateFile failed. + 2012-10-04 Paul Eggert * profiler.c (handle_profiler_signal): Inhibit pending signals too, diff --git a/src/w32.c b/src/w32.c index 3d3ae7eebc3..6b52fb8398d 100644 --- a/src/w32.c +++ b/src/w32.c @@ -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); -- 2.39.5