summaryrefslogtreecommitdiff
path: root/dln.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-23 02:26:47 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-23 02:26:47 +0000
commit5a7c9df5b5af15a1dff214af787a4dbfbd96b3c5 (patch)
treeca5df15d2e1e79b11a5b1a1525da8edb7b527a51 /dln.c
parentbe8326b2e0e8702100d4c667ee749c8d28aed6f4 (diff)
* dln.c (dln_find_1): removed duplication.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'dln.c')
-rw-r--r--dln.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/dln.c b/dln.c
index f11e642c3f..a5c7615df4 100644
--- a/dln.c
+++ b/dln.c
@@ -1557,8 +1557,8 @@ dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
size_t j;
int is_abs = 0, has_path = 0;
const char *ext = 0;
- const char *p = fname;
#endif
+ const char *p = fname;
static const char pathname_too_long[] = "openpath: pathname too long (ignored)\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);
goto needs_extension;
}
+ p = fname;
#endif
- RETURN_IF(fname[0] == '/');
- RETURN_IF(strncmp("./", fname, 2) == 0 || strncmp("../", fname, 3) == 0);
+ if (*p == '.' && *++p == '.') ++p;
+ RETURN_IF(*p == '/');
RETURN_IF(exe_flag && strchr(fname, '/'));
#undef RETURN_IF