summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-05-23 14:08:52 +0000
committerChristopher Faylor <me@cgf.cx>2000-05-23 14:08:52 +0000
commit2dd78662b79be63eec5b141346e3e076c4f80e2f (patch)
tree5144085a0d32d8c31ea3aa9079d9e46677628417 /winsup/cygwin/path.cc
parent8a06cd1b8718dffe2ede4f8b41b8a8c4afe06406 (diff)
downloadcygnal-2dd78662b79be63eec5b141346e3e076c4f80e2f.tar.gz
cygnal-2dd78662b79be63eec5b141346e3e076c4f80e2f.tar.bz2
cygnal-2dd78662b79be63eec5b141346e3e076c4f80e2f.zip
* path.cc (mount_info::conv_to_posix_path): Avoid putting a trailing slash on a
directory name when the ms-dos path spec is a root directory of a device. * registry.cc (reg_key::build_reg): Set 'key_is_invalid' flag rather than using an INVALID_HANDLE_KEY. (reg_key::get_int): Test for key validity before performing registry operations. (reg_key::set_int): Ditto. (reg_key::get_string): Ditto. (reg_key::set_string): Ditto. (reg_key::kill): Ditto. (reg_key::~reg_key): Ditto.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 0251c9004..dd52d18e1 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1147,8 +1147,9 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
trailing_slash_p = SLASH_P (*lastchar) && lastchar[-1] != ':';
}
- debug_printf ("conv_to_posix_path (%s, %s)", src_path,
- keep_rel_p ? "keep-rel" : "no-keep-rel");
+ debug_printf ("conv_to_posix_path (%s, %s, %s)", src_path,
+ keep_rel_p ? "keep-rel" : "no-keep-rel",
+ trailing_slash_p ? "add-slash" : "no-add-slash");
MALLOC_CHECK;
if (src_path_len >= MAX_PATH)
@@ -1192,9 +1193,11 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
/* SRC_PATH is in the mount table. */
int nextchar;
- if (!pathbuf[mi.native_pathlen])
+ const char *p = pathbuf + mi.native_pathlen;
+
+ if (!*p || !p[1])
nextchar = 0;
- else if (isdirsep (pathbuf[mi.native_pathlen]))
+ else if (isdirsep (*p))
nextchar = -1;
else
nextchar = 1;
@@ -1206,9 +1209,9 @@ mount_info::conv_to_posix_path (const char *src_path, char *posix_path,
if (addslash)
strcat (posix_path, "/");
if (nextchar)
- slashify (pathbuf + mi.native_pathlen,
+ slashify (p,
posix_path + addslash + (mi.posix_pathlen == 1 ? 0 : mi.posix_pathlen),
- trailing_slash_p);
+ trailing_slash_p);
goto out;
}