From 0280127761c2288c7d95920c7a2e32fe930e3b0c Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 3 Nov 2020 17:03:35 +0700 Subject: [PATCH] Fix Unix.utimes not working for directories on Win32. (#8796) --- Changes | 4 ++++ otherlibs/win32unix/utimes.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 8d839dc82..86d27368d 100644 --- a/Changes +++ b/Changes @@ -294,6 +294,10 @@ OCaml 4.12.0 ### Other libraries: +- #8796: On Windows, make Unix.utimes use FILE_FLAG_BACKUP_SEMANTICS flag + to allow it to work with directories. + (Daniil Baturin, review by Damien Doligez) + * #9206, #9419: update documentation of the threads library; deprecate Thread.kill, Thread.wait_read, Thread.wait_write, and the whole ThreadUnix module. diff --git a/otherlibs/win32unix/utimes.c b/otherlibs/win32unix/utimes.c index cf448c2ae..548a07c37 100644 --- a/otherlibs/win32unix/utimes.c +++ b/otherlibs/win32unix/utimes.c @@ -56,7 +56,7 @@ CAMLprim value unix_utimes(value path, value atime, value mtime) FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, - 0, + FILE_FLAG_BACKUP_SEMANTICS, NULL); caml_leave_blocking_section(); caml_stat_free(wpath);