Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-07-29 21:36:05 +0400
committerChristopher Faylor <me@cgf.cx>2000-07-29 21:36:05 +0400
commitaf5153a036ede09a399ecd1a241bbba02b83d3e8 (patch)
tree1e419e97fe1949dba6c66a93bfc677600a3e8491 /winsup
parentcc631726d3e1609570170564e442bf735b906448 (diff)
* path.cc (chdir): Avoid trailing dot calculation when chdir == '/' or we end
up with an empty string.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/path.cc2
2 files changed, 6 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index e1e7020c9..3aaeece54 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+Sat Jul 29 13:33:49 2000 Christopher Faylor <cgf@cygnus.com>
+
+ * path.cc (chdir): Avoid trailing dot calculation when chdir == '/'
+ or we end up with an empty string.
+
Sat Jul 29 12:11:33 2000 Christopher Faylor <cgf@cygnus.com>
* include/cygwin/version.h: Bump DLL minor version number to 5 due
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);