summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS3
-rw-r--r--src/posix/posix-cd.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/AUTHORS b/AUTHORS
index 8aa64da..8c92dc2 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -21,4 +21,5 @@ Thanks to:
Colin Booth <colin@heliocat.net>
Jesse Young <jlyo@jlyo.org>
Danilo Spinella <danyspin97@protonmail.com>
- Éric Vidal <eric@obarun.org>
+ Éric Vidal <eric@obarun.org
+ Samuel Holland <samuel@sholland.org>
diff --git a/src/posix/posix-cd.c b/src/posix/posix-cd.c
index f825be1..1addd8e 100644
--- a/src/posix/posix-cd.c
+++ b/src/posix/posix-cd.c
@@ -55,7 +55,7 @@ int main (int argc, char const **argv, char const *const *envp)
}
if (!where || !where[0]) dieusage() ;
- if ((where[0] != '/' && (where[0] != '.')) || (where[1] && where[1] != '.'))
+ if (!(where[0] == '/' || (where[0] == '.' && (!where[1] || where[1] == '/' || (where[1] == '.' && (!where[2] || where[2] == '/'))))))
{
char const *cdpath = getenv("CDPATH") ;
if (cdpath)