From af5153a036ede09a399ecd1a241bbba02b83d3e8 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sat, 29 Jul 2000 17:36:05 +0000 Subject: * path.cc (chdir): Avoid trailing dot calculation when chdir == '/' or we end up with an empty string. --- winsup/cygwin/path.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'winsup/cygwin/path.cc') diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index a46ac4f41..469de5e94 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -2642,7 +2642,7 @@ chdir (const char *dir) of dots > 2 here instead of returning an error code. Counts of dots <= 2 are already eliminated by normalize_posix_path. */ char *last_slash = strrchr (pathbuf, '/'); - if (last_slash && strspn (last_slash + 1, ".") == strlen (last_slash + 1)) + if (last_slash > pathbuf && strspn (last_slash + 1, ".") == strlen (last_slash + 1)) *last_slash = '\0'; free (cwd_posix); cwd_posix = strdup (pathbuf); -- cgit v1.2.3