mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/win32.c (rb_w32_utime): drop read-only attribute before
changing file time. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8fe090790d
commit
f0ab5bdea2
2 changed files with 10 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Tue Feb 14 13:47:22 2006 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* win32/win32.c (rb_w32_utime): drop read-only attribute before
|
||||||
|
changing file time.
|
||||||
|
|
||||||
Tue Feb 14 13:38:01 2006 NAKAMURA Usaku <usa@ruby-lang.org>
|
Tue Feb 14 13:38:01 2006 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* win32/Makefile.sub (config.h): should define HAVE_LONG_LONG with
|
* win32/Makefile.sub (config.h): should define HAVE_LONG_LONG with
|
||||||
|
|
|
@ -3871,6 +3871,9 @@ rb_w32_utime(const char *path, const struct utimbuf *times)
|
||||||
}
|
}
|
||||||
|
|
||||||
RUBY_CRITICAL({
|
RUBY_CRITICAL({
|
||||||
|
const DWORD attr = GetFileAttributes(path);
|
||||||
|
if (attr != (DWORD)-1 && (attr & FILE_ATTRIBUTE_READONLY))
|
||||||
|
SetFileAttributes(path, attr & ~FILE_ATTRIBUTE_READONLY);
|
||||||
hFile = CreateFile(path, GENERIC_WRITE, 0, 0, OPEN_EXISTING,
|
hFile = CreateFile(path, GENERIC_WRITE, 0, 0, OPEN_EXISTING,
|
||||||
IsWin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS, 0);
|
IsWin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS, 0);
|
||||||
if (hFile == INVALID_HANDLE_VALUE) {
|
if (hFile == INVALID_HANDLE_VALUE) {
|
||||||
|
@ -3884,6 +3887,8 @@ rb_w32_utime(const char *path, const struct utimbuf *times)
|
||||||
}
|
}
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
}
|
}
|
||||||
|
if (attr != (DWORD)-1 && (attr & FILE_ATTRIBUTE_READONLY))
|
||||||
|
SetFileAttributes(path, attr);
|
||||||
});
|
});
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue