* win32/win32.c (rb_w32_utime): never use utime() of C runtime.
[ruby-talk:77782] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
096f7a4c89
commit
381ff05505
@ -1,3 +1,8 @@
|
|||||||
|
Mon Aug 4 02:34:05 2003 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* win32/win32.c (rb_w32_utime): never use utime() of C runtime.
|
||||||
|
[ruby-talk:77782]
|
||||||
|
|
||||||
Sun Aug 3 23:56:50 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Aug 3 23:56:50 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (rb_call_super): should propagate previous block for
|
* eval.c (rb_call_super): should propagate previous block for
|
||||||
|
@ -3178,7 +3178,7 @@ unixtime_to_filetime(time_t time, FILETIME *ft)
|
|||||||
int
|
int
|
||||||
rb_w32_utime(const char *path, struct utimbuf *times)
|
rb_w32_utime(const char *path, struct utimbuf *times)
|
||||||
{
|
{
|
||||||
HANDLE hDir;
|
HANDLE hFile;
|
||||||
SYSTEMTIME st;
|
SYSTEMTIME st;
|
||||||
FILETIME atime, mtime;
|
FILETIME atime, mtime;
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
@ -3188,9 +3188,6 @@ rb_w32_utime(const char *path, struct utimbuf *times)
|
|||||||
if (rb_w32_stat(path, &stat)) {
|
if (rb_w32_stat(path, &stat)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!(stat.st_mode & S_IFDIR) || IsWin95()) {
|
|
||||||
return utime(path, times);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unixtime_to_filetime(times->actime, &atime)) {
|
if (unixtime_to_filetime(times->actime, &atime)) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -3199,17 +3196,21 @@ rb_w32_utime(const char *path, struct utimbuf *times)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hDir = CreateFile(path, GENERIC_WRITE, 0, 0, OPEN_EXISTING,
|
RUBY_CRITICAL({
|
||||||
FILE_FLAG_BACKUP_SEMANTICS, 0);
|
hFile = CreateFile(path, GENERIC_WRITE, 0, 0, OPEN_EXISTING,
|
||||||
if (hDir == INVALID_HANDLE_VALUE) {
|
IsWin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS, 0);
|
||||||
errno = map_errno();
|
if (hFile == INVALID_HANDLE_VALUE) {
|
||||||
return -1;
|
errno = map_errno();
|
||||||
}
|
ret = -1;
|
||||||
if (!SetFileTime(hDir, NULL, &atime, &mtime)) {
|
}
|
||||||
errno = map_errno();
|
else {
|
||||||
ret = -1;
|
if (!SetFileTime(hFile, NULL, &atime, &mtime)) {
|
||||||
}
|
errno = map_errno();
|
||||||
CloseHandle(hDir);
|
ret = -1;
|
||||||
|
}
|
||||||
|
CloseHandle(hFile);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user