From 5a7c9df5b5af15a1dff214af787a4dbfbd96b3c5 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 23 Nov 2009 02:26:47 +0000 Subject: [PATCH] * dln.c (dln_find_1): removed duplication. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 2 +- dln.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index f0197d9359..ee58a2dea5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -Mon Nov 23 10:52:19 2009 Nobuyoshi Nakada +Mon Nov 23 11:26:45 2009 Nobuyoshi Nakada * dln.c (dln_find_1): removed duplication. 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