diff options
| author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-22 19:22:14 +0000 |
|---|---|---|
| committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-22 19:22:14 +0000 |
| commit | ebdad95cb167e463328d144ab3d1bd2aa211d852 (patch) | |
| tree | aef70a5a027001ca3d66592cc3109936222dca9a /dir.c | |
| parent | 2902b95032965679cbd27a495493f70a850f5a31 (diff) | |
| download | ruby-ebdad95cb167e463328d144ab3d1bd2aa211d852.tar.gz ruby-ebdad95cb167e463328d144ab3d1bd2aa211d852.tar.xz ruby-ebdad95cb167e463328d144ab3d1bd2aa211d852.zip | |
merge -c 12210
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_6@12329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dir.c')
| -rw-r--r-- | dir.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -958,13 +958,19 @@ sys_warning_1(mesg) #define GLOB_ALLOC_N(type, n) (type *)malloc(sizeof(type) * (n)) #define GLOB_JUMP_TAG(status) ((status == -1) ? rb_memerror() : rb_jump_tag(status)) +/* + * ENOTDIR can be returned by stat(2) if a non-leaf element of the path + * is not a directory. + */ +#define to_be_ignored(e) ((e) == ENOENT || (e) == ENOTDIR) + /* System call with warning */ static int do_stat(const char *path, struct stat *pst, int flags) { int ret = stat(path, pst); - if (ret < 0 && errno != ENOENT) + if (ret < 0 && !to_be_ignored(errno)) sys_warning(path); return ret; @@ -974,7 +980,7 @@ static int do_lstat(const char *path, struct stat *pst, int flags) { int ret = lstat(path, pst); - if (ret < 0 && errno != ENOENT) + if (ret < 0 && !to_be_ignored(errno)) sys_warning(path); return ret; @@ -984,7 +990,7 @@ static DIR * do_opendir(const char *path, int flags) { DIR *dirp = opendir(path); - if (dirp == NULL && errno != ENOENT && errno != ENOTDIR) + if (dirp == NULL && !to_be_ignored(errno)) sys_warning(path); return dirp; |
