aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorPierre Humblet <phumblet@phumblet.no-ip.org>2004-04-12 23:59:23 +0000
committerPierre Humblet <phumblet@phumblet.no-ip.org>2004-04-12 23:59:23 +0000
commitb96dbd203d4115d3a18c8cbc3660c0f640508033 (patch)
treeddbf7ddd47160a63ecdd3fc7a7e5c6518475b102 /winsup/cygwin/path.cc
parent1ed8d18733295428499ee4ee620ad22acb172c27 (diff)
downloadnewlib-b96dbd203d4115d3a18c8cbc3660c0f640508033.zip
newlib-b96dbd203d4115d3a18c8cbc3660c0f640508033.tar.gz
newlib-b96dbd203d4115d3a18c8cbc3660c0f640508033.tar.bz2
2004-04-12 Pierre Humblet <pierre.humblet@ieee.org>
* path.cc (path_conv::check): Fix "tail filling" logic.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 1fc9fc3..77c9087 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -499,7 +499,7 @@ path_conv::check (const char *src, unsigned opt,
bool need_directory = 0;
bool saw_symlinks = 0;
int is_relpath;
- char *tail;
+ char *tail, *path_end;
#if 0
static path_conv last_path_conv;
@@ -544,7 +544,7 @@ path_conv::check (const char *src, unsigned opt,
need_directory = 1;
*--tail = '\0';
}
- char *path_end = tail;
+ path_end = tail;
/* Scan path_copy from right to left looking either for a symlink
or an actual existing file. If an existing file is found, just
@@ -872,7 +872,7 @@ out:
normalized_path_size = 0;
else
{
- if (tail[1] != '\0')
+ if (tail < path_end && tail > path_copy + 1)
*tail = '/';
set_normalized_path (path_copy);
}