* 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.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user