[前][次][番号順一覧][スレッド一覧]

ruby-changes:13328

From: usa <ko1@a...>
Date: Fri, 25 Sep 2009 16:06:55 +0900 (JST)
Subject: [ruby-changes:13328] Ruby:r25092 (trunk): * win32/win32.c, include/ruby/win32.h (rb_w32_access): new function to

usa	2009-09-25 16:04:25 +0900 (Fri, 25 Sep 2009)

  New Revision: 25092

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25092

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/file.c
    trunk/include/ruby/win32.h
    trunk/win32/win32.c

Index: include/ruby/win32.h
===================================================================
--- include/ruby/win32.h	(revision 25091)
+++ include/ruby/win32.h	(revision 25092)
@@ -191,6 +191,7 @@
 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
@@ -278,6 +279,7 @@
 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 *);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 25091)
+++ ChangeLog	(revision 25092)
@@ -1,3 +1,11 @@
+Fri Sep 25 16:01:45 2009  NAKAMURA Usaku  <usa@r...>
+
+	* 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.
+
 Fri Sep 25 13:04:46 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* proc.c (mnew): fix for instance method of Module, BasicObjec
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 25091)
+++ win32/win32.c	(revision 25092)
@@ -4054,6 +4054,20 @@
     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)
 {
Index: file.c
===================================================================
--- file.c	(revision 25091)
+++ file.c	(revision 25092)
@@ -964,9 +964,6 @@
 
     return -1;
 #else
-# if defined(_MSC_VER) || defined(__MINGW32__)
-    mode &= ~1;
-# endif
     return access(path, mode);
 #endif
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]