1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* dln.c (dln_find_1): removed duplication.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-11-23 02:26:47 +00:00
parent be8326b2e0
commit 5a7c9df5b5
2 changed files with 5 additions and 4 deletions

View file

@ -1,4 +1,4 @@
Mon Nov 23 10:52:19 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> Mon Nov 23 11:26:45 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dln.c (dln_find_1): removed duplication. * dln.c (dln_find_1): removed duplication.

7
dln.c
View file

@ -1557,8 +1557,8 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
size_t j; size_t j;
int is_abs = 0, has_path = 0; int is_abs = 0, has_path = 0;
const char *ext = 0; const char *ext = 0;
const char *p = fname;
#endif #endif
const char *p = fname;
static const char pathname_too_long[] = "openpath: pathname too long (ignored)\n\ static const char pathname_too_long[] = "openpath: pathname too long (ignored)\n\
\tDirectory \"%.*s\"\n\tFile \"%s\"\n"; \tDirectory \"%.*s\"\n\tFile \"%s\"\n";
@ -1620,10 +1620,11 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
memcpy(fbuf, fname, i + 1); memcpy(fbuf, fname, i + 1);
goto needs_extension; goto needs_extension;
} }
p = fname;
#endif #endif
RETURN_IF(fname[0] == '/'); if (*p == '.' && *++p == '.') ++p;
RETURN_IF(strncmp("./", fname, 2) == 0 || strncmp("../", fname, 3) == 0); RETURN_IF(*p == '/');
RETURN_IF(exe_flag && strchr(fname, '/')); RETURN_IF(exe_flag && strchr(fname, '/'));
#undef RETURN_IF #undef RETURN_IF