mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ruby.h: rb_sys_stat -> stat
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9910feef4f
commit
9ea56f8efe
3 changed files with 11 additions and 15 deletions
8
dir.c
8
dir.c
|
@ -62,7 +62,7 @@ char *strchr _((char*,char));
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#ifndef HAVE_LSTAT
|
#ifndef HAVE_LSTAT
|
||||||
#define lstat rb_sys_stat
|
#define lstat(path,st) stat(path,st)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FNM_NOESCAPE 0x01
|
#define FNM_NOESCAPE 0x01
|
||||||
|
@ -622,7 +622,7 @@ glob_helper(path, flag, func, arg)
|
||||||
|
|
||||||
if (!has_magic(path, 0)) {
|
if (!has_magic(path, 0)) {
|
||||||
remove_backslashes(path);
|
remove_backslashes(path);
|
||||||
if (rb_sys_stat(path, &st) == 0) {
|
if (stat(path, &st) == 0) {
|
||||||
(*func)(path, arg);
|
(*func)(path, arg);
|
||||||
}
|
}
|
||||||
else if (errno != ENOENT) {
|
else if (errno != ENOENT) {
|
||||||
|
@ -653,7 +653,7 @@ glob_helper(path, flag, func, arg)
|
||||||
else dir = base;
|
else dir = base;
|
||||||
|
|
||||||
magic = extract_elem(p);
|
magic = extract_elem(p);
|
||||||
if (rb_sys_stat(dir, &st) < 0) {
|
if (stat(dir, &st) < 0) {
|
||||||
if (errno != ENOENT) rb_sys_warning(dir);
|
if (errno != ENOENT) rb_sys_warning(dir);
|
||||||
free(base);
|
free(base);
|
||||||
break;
|
break;
|
||||||
|
@ -721,7 +721,7 @@ glob_helper(path, flag, func, arg)
|
||||||
free(magic);
|
free(magic);
|
||||||
if (link) {
|
if (link) {
|
||||||
while (link) {
|
while (link) {
|
||||||
if (rb_sys_stat(link->path, &st) == 0) {
|
if (stat(link->path, &st) == 0) {
|
||||||
if (S_ISDIR(st.st_mode)) {
|
if (S_ISDIR(st.st_mode)) {
|
||||||
int len = strlen(link->path);
|
int len = strlen(link->path);
|
||||||
int mlen = strlen(m);
|
int mlen = strlen(m);
|
||||||
|
|
14
file.c
14
file.c
|
@ -67,7 +67,7 @@ char *strrchr _((const char*,const char));
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#ifndef HAVE_LSTAT
|
#ifndef HAVE_LSTAT
|
||||||
#define lstat stat
|
#define lstat(path,st) stat(path,st)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
VALUE rb_cFile;
|
VALUE rb_cFile;
|
||||||
|
@ -313,7 +313,7 @@ rb_stat(file, st)
|
||||||
#if defined DJGPP
|
#if defined DJGPP
|
||||||
if (RSTRING(file)->len == 0) return -1;
|
if (RSTRING(file)->len == 0) return -1;
|
||||||
#endif
|
#endif
|
||||||
return rb_sys_stat(RSTRING(file)->ptr, st);
|
return stat(RSTRING(file)->ptr, st);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -323,7 +323,7 @@ rb_file_s_stat(obj, fname)
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
Check_SafeStr(fname);
|
Check_SafeStr(fname);
|
||||||
if (rb_sys_stat(RSTRING(fname)->ptr, &st) == -1) {
|
if (stat(RSTRING(fname)->ptr, &st) == -1) {
|
||||||
rb_sys_fail(RSTRING(fname)->ptr);
|
rb_sys_fail(RSTRING(fname)->ptr);
|
||||||
}
|
}
|
||||||
return stat_new(&st);
|
return stat_new(&st);
|
||||||
|
@ -419,7 +419,7 @@ eaccess(path, mode)
|
||||||
struct stat st;
|
struct stat st;
|
||||||
static int euid = -1;
|
static int euid = -1;
|
||||||
|
|
||||||
if (rb_sys_stat(path, &st) < 0) return (-1);
|
if (stat(path, &st) < 0) return (-1);
|
||||||
|
|
||||||
if (euid == -1)
|
if (euid == -1)
|
||||||
euid = geteuid ();
|
euid = geteuid ();
|
||||||
|
@ -721,7 +721,7 @@ check3rdbyte(file, mode)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (rb_sys_stat(file, &st) < 0) return Qfalse;
|
if (stat(file, &st) < 0) return Qfalse;
|
||||||
if (st.st_mode & mode) return Qtrue;
|
if (st.st_mode & mode) return Qtrue;
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
}
|
}
|
||||||
|
@ -2115,7 +2115,7 @@ path_check_1(path)
|
||||||
return path_check_1(buf);
|
return path_check_1(buf);
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (rb_sys_stat(path, &st) == 0 && (st.st_mode & 002)) {
|
if (stat(path, &st) == 0 && (st.st_mode & 002)) {
|
||||||
if (p) *p = '/';
|
if (p) *p = '/';
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2234,7 +2234,7 @@ rb_find_file(file)
|
||||||
}
|
}
|
||||||
|
|
||||||
path = dln_find_file(file, path);
|
path = dln_find_file(file, path);
|
||||||
if (path && rb_sys_stat(path, &st) == 0) {
|
if (path && stat(path, &st) == 0) {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
4
ruby.h
4
ruby.h
|
@ -592,10 +592,6 @@ rb_special_const_p(VALUE obj)
|
||||||
static char *dln_libs_to_be_linked[] = { EXTLIB, 0 };
|
static char *dln_libs_to_be_linked[] = { EXTLIB, 0 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef rb_sys_stat
|
|
||||||
#define rb_sys_stat stat
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
} /* extern "C" { */
|
} /* extern "C" { */
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue