Commit e8ffe523 authored by Janne Hyvärinen's avatar Janne Hyvärinen Committed by Erik de Castro Lopo
Browse files

Windows utf8 utime fix.

UTF-8 version of utime was completely broken and file timestamps were
not preserved.
Signed-off-by: Erik de Castro Lopo's avatarErik de Castro Lopo <>
parent 52fab8ba
......@@ -259,22 +259,20 @@ int chmod_utf8(const char *filename, int pmode)
int utime_utf8(const char *filename, struct utimbuf *times)
wchar_t *wname;
struct _utimbuf ut;
struct __utimbuf64 ut;
int ret;
if (!(wname = wchar_from_utf8(filename))) return -1;
ret = _wutime(wname, &ut);
if (ret != -1) {
if (sizeof(*times) == sizeof(ut)) {
memcpy(times, &ut, sizeof(ut));
memcpy(&ut, times, sizeof(ut));
} else {
times->actime = ut.actime;
times->modtime = ut.modtime;
ut.actime = times->actime;
ut.modtime = times->modtime;
if (!(wname = wchar_from_utf8(filename))) return -1;
ret = _wutime64(wname, &ut);
return ret;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment