From 16b6cb5412b4238cd520cd9b3fea2dec362349c6 Mon Sep 17 00:00:00 2001 From: Louis Lenders Date: Fri, 29 Apr 2011 10:34:54 +0200 Subject: msvcrt: fix utime to correctly handle a NULL-pointer for the utimbuf structure field --- dlls/msvcrt/file.c | 4 ++++ dlls/msvcrt/tests/file.c | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 30613ca..2048601 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -2243,6 +2243,10 @@ int CDECL _utime64(const char* path, struct MSVCRT___utimbuf64 *t) int CDECL _utime32(const char* path, struct MSVCRT___utimbuf32 *t) { struct MSVCRT___utimbuf64 t64; + + if (!t) + return _utime64( path, NULL ); + t64.actime = t->actime; t64.modtime = t->modtime; return _utime64( path, &t64 ); diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c index 60c76f9..50d288d 100644 --- a/dlls/msvcrt/tests/file.c +++ b/dlls/msvcrt/tests/file.c @@ -1561,14 +1561,13 @@ static void test_utime(void) trace("changed the modification time to %s\n", ctime(&info.st_mtime)); trace("changed the access time to %s\n", ctime(&info.st_atime)); -#if(0) /* FIXME: this test crashes wine, remove this line when wine is fixed */ /* test with NULL pointer */ ok(p_utime("fd.tst", NULL) == 0, "utime failed\n"); ok(stat("fd.tst", &info) == 0, "file-status information could not be obtained\n"); trace(" changed the modification time back to %s\n", ctime(&info.st_mtime)); trace(" changed the access time back to %s\n", ctime(&info.st_atime)); -#endif + ok(close(fd) == 0, "Couldn't close testfile\n"); ok(unlink("fd.tst") == 0, "Couldn't unlink\n"); } -- 1.7.4.1