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-06-15 23:44:50 +0400
committerChristopher Faylor <me@cgf.cx>2000-06-15 23:44:50 +0400
commit54ee4247114ad755c4ab32c0c69ee1f88ddae7d5 (patch)
tree39f04ad3060963ce120e24590a22674edcae5f38 /winsup
parent48b1381da190c12810f4476744d33b22c77e0845 (diff)
* path.cc (normalize_posix_path): Convert path to POSIX if it seems to be a
Windows path.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog11
-rw-r--r--winsup/cygwin/path.cc54
2 files changed, 46 insertions, 19 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 9d47d39bb..4facd8b4e 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,14 @@
+Thu Jun 15 15:43:50 2000 Christopher Faylor <cgf@cygnus.com>
+
+ * path.cc (normalize_posix_path): Convert path to POSIX if it seems to
+ be a Windows path.
+
+2000-06-15 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
+
+ * path.cc (mount_info::add_item): Eliminate a trailing backslash
+ included in a native path starting with '//[A-Za-z]/...'.
+ * path.cc (mount_info::del_item): Accept a native path as its target.
+
Wed Jun 14 23:47:19 2000 Christopher Faylor <cgf@cygnus.com>
* environ.cc (conv_envvars): Detect and convert all environment
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 2b7e58be0..d9b21ebac 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -556,6 +556,11 @@ normalize_posix_path (const char *cwd, const char *src, char *dst)
char *dst_start = dst;
syscall_printf ("cwd %s, src %s", cwd, src);
+ if (isdrive (src) || strpbrk (src, "\\:/"))
+ {
+ cygwin_conv_to_full_posix_path (src, dst);
+ return 0;
+ }
if (!isslash (src[0]))
{
if (strlen (cwd) + 1 + strlen (src) >= MAX_PATH)
@@ -1614,10 +1619,8 @@ mount_info::add_item (const char *native, const char *posix, unsigned mountflags
if (slash_drive_prefix_p (native))
slash_drive_to_win32_path (native, nativetmp, 0);
else
- {
- backslashify (native, nativetmp, 0);
- nofinalslash (nativetmp, nativetmp);
- }
+ backslashify (native, nativetmp, 0);
+ nofinalslash (nativetmp, nativetmp);
slashify (posix, posixtmp, 0);
nofinalslash (posixtmp, posixtmp);
@@ -1677,36 +1680,49 @@ int
mount_info::del_item (const char *path, unsigned flags, int reg_p)
{
char pathtmp[MAX_PATH];
+ int posix_path_p = FALSE;
/* Something's wrong if path is NULL or empty. */
- if (path == NULL || *path == 0)
+ if (path == NULL || *path == 0 || !isabspath (path))
{
set_errno (EINVAL);
return -1;
}
- slashify (path, pathtmp, 0);
+ if (slash_drive_prefix_p (path))
+ slash_drive_to_win32_path (path, pathtmp, 0);
+ else if (slash_unc_prefix_p (path) || strpbrk (path, ":\\"))
+ backslashify (path, pathtmp, 0);
+ else
+ {
+ slashify (path, pathtmp, 0);
+ posix_path_p = TRUE;
+ }
nofinalslash (pathtmp, pathtmp);
- debug_printf ("%s[%s]", path, pathtmp);
-
- if (reg_p && del_reg_mount (pathtmp, flags)
- && del_reg_mount (path, flags)) /* for old irregular entries */
+ if (reg_p && posix_path_p &&
+ del_reg_mount (pathtmp, flags) &&
+ del_reg_mount (path, flags)) /* for old irregular entries */
return -1;
for (int i = 0; i < nmounts; i++)
{
- /* Delete if paths and mount locations match. */
- if ((strcasematch (mount[i].posix_path, pathtmp)
- || strcasematch (mount[i].native_path, pathtmp)) &&
- (mount[i].flags & MOUNT_SYSTEM) == (flags & MOUNT_SYSTEM))
+ int ent = native_sorted[i]; /* in the same order as getmntent() */
+ if (((posix_path_p)
+ ? strcasematch (mount[ent].posix_path, pathtmp)
+ : strcasematch (mount[ent].native_path, pathtmp)) &&
+ (mount[ent].flags & MOUNT_SYSTEM) == (flags & MOUNT_SYSTEM))
{
- nmounts--; /* One less mount table entry */
+ if (!posix_path_p &&
+ reg_p && del_reg_mount (mount[ent].posix_path, flags))
+ return -1;
+
+ nmounts--; /* One less mount table entry */
/* Fill in the hole if not at the end of the table */
- if (i < nmounts)
- memmove (mount + i, mount + i + 1,
- sizeof (mount[i]) * (nmounts - i));
- sort (); /* Resort the table */
+ if (ent < nmounts)
+ memmove (mount + ent, mount + ent + 1,
+ sizeof (mount[ent]) * (nmounts - ent));
+ sort (); /* Resort the table */
return 0;
}
}