summaryrefslogtreecommitdiff
path: root/win32/win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 28fb467768..43c69078d4 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -2731,6 +2731,24 @@ isUNCRoot(const char *path)
return 0;
}
+#ifdef __BORLANDC__
+#undef fstat
+int
+rb_w32_fstat(int fd, struct stat *st)
+{
+ BY_HANDLE_FILE_INFORMATION info;
+ int ret = fstat(fd, st);
+
+ if (ret) return ret;
+ st->st_mode &= ~(S_IWGRP | S_IWOTH);
+ if (GetFileInformationByHandle((HANDLE)_get_osfhandle(fd), &info) &&
+ !(info.dwFileAttributes & FILE_ATTRIBUTE_READONLY)) {
+ st->st_mode |= S_IWUSR;
+ }
+ return ret;
+}
+#endif
+
int
rb_w32_stat(const char *path, struct stat *st)
{