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