aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-06-15 20:35:51 +0000
committerChristopher Faylor <me@cgf.cx>2001-06-15 20:35:51 +0000
commit947ab99ee964fe52e1c02f2d6e63e50bb533fcc0 (patch)
treedbfcee1f223fd14103ba76a19acc5c924ee12aaf
parentdb77b1b43eb68d34d5730b02dea826dd8f3bef95 (diff)
downloadnewlib-947ab99ee964fe52e1c02f2d6e63e50bb533fcc0.zip
newlib-947ab99ee964fe52e1c02f2d6e63e50bb533fcc0.tar.gz
newlib-947ab99ee964fe52e1c02f2d6e63e50bb533fcc0.tar.bz2
* path.cc (path_conv::check): Deal more robustly with foo/ behavior.
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/path.cc12
2 files changed, 10 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index e1cd49b..e32840c 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+Fri Jun 15 14:34:19 2001 Christopher Faylor <cgf@cygnus.com>
+
+ * path.cc (path_conv::check): Deal more robustly with foo/ behavior.
+
Fri Jun 15 11:15:00 2001 Corinna Vinschen <corinna@vinschen.de>
* fhandler_tape.cc (fhandler_dev_tape::tape_status): Set size
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index cffbece..414efcf 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -411,18 +411,18 @@ path_conv::check (const char *src, unsigned opt,
{
MALLOC_CHECK;
assert (src);
- char *p = strrchr (src, '/');
+
+ char *p = strrchr (src, '\0');
/* Detect if the user was looking for a directory. We have to strip the
trailing slash initially and add it back on at the end due to Windows
brain damage. */
- if (p)
+ if (--p > src)
{
- if (p[1] == '\0' || strcmp (p, "/.") == 0)
+ if (isdirsep (*p))
+ need_directory = 1;
+ else if (--p > src && p[1] == '.' && isdirsep (*p))
need_directory = 1;
}
- else if ((p = strrchr (src, '\\')) &&
- (p[1] == '\0' || strcmp (p, "\\.") == 0))
- need_directory = 1;
is_relpath = !isabspath (src);
error = normalize_posix_path (src, path_copy);