summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-05 09:40:41 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-05 09:40:41 +0000
commita968bd2efb93595c625ca124d3b6f18f525f5814 (patch)
tree0289319f36226f230951dd2a0af77c05c2c7db21
parent7aae3bd3c37b3f399aa55325a37c8428e5981e2d (diff)
downloadruby-a968bd2efb93595c625ca124d3b6f18f525f5814.tar.gz
ruby-a968bd2efb93595c625ca124d3b6f18f525f5814.tar.xz
ruby-a968bd2efb93595c625ca124d3b6f18f525f5814.zip
merges r25092 from trunk into ruby_1_9_1.
-- * win32/win32.c, include/ruby/win32.h (rb_w32_access): new function to replace MSVCRT's access(). [ruby-core:25761] * file.c (eaccess): workaround for recent MSVCRT is no longer needed. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@26017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--file.c3
-rw-r--r--include/ruby/win32.h2
-rw-r--r--version.h2
-rw-r--r--win32/win32.c14
5 files changed, 25 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 9d4d6f32b..ba39baaa1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Sep 25 16:01:45 2009 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c, include/ruby/win32.h (rb_w32_access): new function to
+ replace MSVCRT's access().
+ [ruby-core:25761]
+
+ * file.c (eaccess): workaround for recent MSVCRT is no longer needed.
+
Mon Sep 28 19:36:20 2009 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/wini32.c (LK_ERR): with overlapped I/O, LockFileEx() returns
diff --git a/file.c b/file.c
index 9c9da582e..3a023561e 100644
--- a/file.c
+++ b/file.c
@@ -945,9 +945,6 @@ eaccess(const char *path, int mode)
return -1;
#else
-# if defined(_MSC_VER) || defined(__MINGW32__)
- mode &= ~1;
-# endif
return access(path, mode);
#endif
}
diff --git a/include/ruby/win32.h b/include/ruby/win32.h
index c8da5044a..fd654e459 100644
--- a/include/ruby/win32.h
+++ b/include/ruby/win32.h
@@ -196,6 +196,7 @@ extern DWORD rb_w32_osid(void);
extern int rb_w32_stat(const char *, struct stat *);
extern int rb_w32_fstat(int, struct stat *);
#endif
+#define access(path,mode) rb_w32_access(path,mode)
#define strcasecmp stricmp
#define strncasecmp strnicmp
@@ -266,6 +267,7 @@ extern int rb_w32_mkdir(const char *, int);
extern int rb_w32_rmdir(const char *);
extern int rb_w32_unlink(const char *);
extern int rb_w32_stati64(const char *, struct stati64 *);
+extern int rb_w32_access(const char *, int);
#ifdef __BORLANDC__
extern int rb_w32_fstati64(int, struct stati64 *);
diff --git a/version.h b/version.h
index e4a3dbcb9..de4f6527c 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.1"
-#define RUBY_PATCHLEVEL 370
+#define RUBY_PATCHLEVEL 371
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 9
#define RUBY_VERSION_TEENY 1
diff --git a/win32/win32.c b/win32/win32.c
index 0f60dcd7a..345fcdd15 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -3648,6 +3648,20 @@ rb_w32_stati64(const char *path, struct stati64 *st)
return ret;
}
+int
+rb_w32_access(const char *path, int mode)
+{
+ struct stati64 stat;
+ if (rb_w32_stati64(path, &stat) != 0)
+ return -1;
+ mode <<= 6;
+ if ((stat.st_mode & mode) != mode) {
+ errno = EACCES;
+ return -1;
+ }
+ return 0;
+}
+
static int
rb_chsize(HANDLE h, off_t size)
{