* mount.cc (do_mount_from_fstab): Allow to change cygdrive prefix, too.
This commit is contained in:
parent
2b77087a48
commit
f380ca5803
|
@ -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>
|
2010-01-07 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* cygpath.cc: Throughout, free obsolete path buffers.
|
* cygpath.cc: Throughout, free obsolete path buffers.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* mount.cc
|
/* mount.cc
|
||||||
|
|
||||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005,
|
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.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -150,22 +150,41 @@ do_mount_from_fstab (const char *where)
|
||||||
is NULL, all entries match. */
|
is NULL, all entries match. */
|
||||||
bool exists = false;
|
bool exists = false;
|
||||||
for (mnt_t *m = mount_table; m - mount_table < max_mount_entry; ++m)
|
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;
|
if (m->flags & MOUNT_CYGDRIVE)
|
||||||
/* Compare with existing mount table. If the entry doesn't exist,
|
{
|
||||||
mount it. */
|
/* Get the cygdrive info */
|
||||||
FILE *mt = setmntent ("/-not-used-", "r");
|
char user[MAX_PATH];
|
||||||
struct mntent *p;
|
char system[MAX_PATH];
|
||||||
|
char user_flags[MAX_PATH];
|
||||||
|
char system_flags[MAX_PATH];
|
||||||
|
|
||||||
while ((p = getmntent (mt)) != NULL)
|
exists = true;
|
||||||
if (!strcmp (m->posix, p->mnt_dir))
|
cygwin_internal (CW_GET_CYGDRIVE_INFO, user, system, user_flags,
|
||||||
break;
|
system_flags);
|
||||||
if (!p)
|
if ((*user && strcmp (user, m->posix) != 0)
|
||||||
do_mount (m->native, m->posix, m->flags);
|
|| (*system && strcmp (system, m->posix) != 0))
|
||||||
endmntent (mt);
|
if (mount (NULL, m->posix, m->flags))
|
||||||
if (where)
|
error (m->posix);
|
||||||
break;
|
}
|
||||||
|
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)
|
if (!exists && where)
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
|
|
Loading…
Reference in New Issue