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
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-01-11 15:13:55 +0300
committerCorinna Vinschen <corinna@vinschen.de>2010-01-11 15:13:55 +0300
commitf380ca5803732cc20e78c6d1e7610fc840bfe058 (patch)
tree892abe4c1949f08ba5feb25e84734ef95e03c6df /winsup/utils
parent2b77087a48ea56e77fca5aeab478c922f6473d7c (diff)
* mount.cc (do_mount_from_fstab): Allow to change cygdrive prefix, too.
Diffstat (limited to 'winsup/utils')
-rw-r--r--winsup/utils/ChangeLog4
-rw-r--r--winsup/utils/mount.cc51
2 files changed, 39 insertions, 16 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index a8438b57a..ba588d5ad 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,7 @@
+2010-01-11 Corinna Vinschen <corinna@vinschen.de>
+
+ * mount.cc (do_mount_from_fstab): Allow to change cygdrive prefix, too.
+
2010-01-07 Corinna Vinschen <corinna@vinschen.de>
* cygpath.cc: Throughout, free obsolete path buffers.
diff --git a/winsup/utils/mount.cc b/winsup/utils/mount.cc
index 47f14be7f..761488fcb 100644
--- a/winsup/utils/mount.cc
+++ b/winsup/utils/mount.cc
@@ -1,7 +1,7 @@
/* mount.cc
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005,
- 2008, 2009 Red Hat, Inc.
+ 2008, 2009, 2010 Red Hat, Inc.
This file is part of Cygwin.
@@ -150,22 +150,41 @@ do_mount_from_fstab (const char *where)
is NULL, all entries match. */
bool exists = false;
for (mnt_t *m = mount_table; m - mount_table < max_mount_entry; ++m)
- if (!(m->flags & MOUNT_CYGDRIVE) && (!where || !strcmp (where, m->posix)))
+ if (!where || !strcmp (where, m->posix))
{
- exists = true;
- /* Compare with existing mount table. If the entry doesn't exist,
- mount it. */
- FILE *mt = setmntent ("/-not-used-", "r");
- struct mntent *p;
-
- while ((p = getmntent (mt)) != NULL)
- if (!strcmp (m->posix, p->mnt_dir))
- break;
- if (!p)
- do_mount (m->native, m->posix, m->flags);
- endmntent (mt);
- if (where)
- break;
+ if (m->flags & MOUNT_CYGDRIVE)
+ {
+ /* Get the cygdrive info */
+ char user[MAX_PATH];
+ char system[MAX_PATH];
+ char user_flags[MAX_PATH];
+ char system_flags[MAX_PATH];
+
+ exists = true;
+ cygwin_internal (CW_GET_CYGDRIVE_INFO, user, system, user_flags,
+ system_flags);
+ if ((*user && strcmp (user, m->posix) != 0)
+ || (*system && strcmp (system, m->posix) != 0))
+ if (mount (NULL, m->posix, m->flags))
+ error (m->posix);
+ }
+ else
+ {
+ exists = true;
+ /* Compare with existing mount table. If the entry doesn't exist,
+ mount it. */
+ FILE *mt = setmntent ("/-not-used-", "r");
+ struct mntent *p;
+
+ while ((p = getmntent (mt)) != NULL)
+ if (!strcmp (m->posix, p->mnt_dir))
+ break;
+ if (!p)
+ do_mount (m->native, m->posix, m->flags);
+ endmntent (mt);
+ if (where)
+ break;
+ }
}
if (!exists && where)
fprintf (stderr,