mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@25092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9d72cb269c
commit
d70e9a5568
4 changed files with 24 additions and 3 deletions
|
@ -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.
|
||||
|
||||
Fri Sep 25 13:04:46 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* proc.c (mnew): fix for instance method of Module, BasicObjec
|
||||
|
|
3
file.c
3
file.c
|
@ -964,9 +964,6 @@ eaccess(const char *path, int mode)
|
|||
|
||||
return -1;
|
||||
#else
|
||||
# if defined(_MSC_VER) || defined(__MINGW32__)
|
||||
mode &= ~1;
|
||||
# endif
|
||||
return access(path, mode);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -191,6 +191,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
|
||||
|
@ -278,6 +279,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 *);
|
||||
|
|
|
@ -4054,6 +4054,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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue