diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/Makefile.sub | 11 | ||||
-rw-r--r-- | win32/win32.c | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 03c4fe3fb5..50f0aa6c46 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -204,17 +204,28 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub #define HAVE_STDLIB_H 1 #define HAVE_STRING_H 1 #define HAVE_MEMORY_H 1 +!if $(MSC_VER) >= 1400 +#define HAVE_LONG_LONG 1 +!endif #define HAVE_OFF_T 1 #define SIZEOF_INT 4 #define SIZEOF_SHORT 2 #define SIZEOF_LONG 4 +!if $(MSC_VER) >= 1400 +#define SIZEOF_LONG_LONG 8 +!else #define SIZEOF_LONG_LONG 0 +!endif #define SIZEOF___INT64 8 #define SIZEOF_OFF_T 4 #define SIZEOF_VOIDP 4 #define SIZEOF_FLOAT 4 #define SIZEOF_DOUBLE 8 +!if $(MSC_VER) >= 1400 +#define SIZEOF_TIME_T 8 +!else #define SIZEOF_TIME_T 4 +!endif #define HAVE_PROTOTYPES 1 #define TOKEN_PASTE(x,y) x##y #define HAVE_STDARG_PROTOTYPES 1 diff --git a/win32/win32.c b/win32/win32.c index ce69f3b826..5bc1f5b245 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -3504,6 +3504,9 @@ rb_w32_utime(const char *path, struct utimbuf *times) } 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, IsWin95() ? 0 : FILE_FLAG_BACKUP_SEMANTICS, 0); if (hFile == INVALID_HANDLE_VALUE) { @@ -3517,6 +3520,8 @@ rb_w32_utime(const char *path, struct utimbuf *times) } CloseHandle(hFile); } + if (attr != (DWORD)-1 && (attr & FILE_ATTRIBUTE_READONLY)) + SetFileAttributes(path, attr); }); return ret; |