summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/path.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-01-28 06:23:42 +0000
committerChristopher Faylor <me@cgf.cx>2001-01-28 06:23:42 +0000
commit9a089f21ea4862705c6c996502c089b8d18fc833 (patch)
tree92c2264c2077b6d7b9a8b8b13dace41879b41471 /winsup/cygwin/path.cc
parent2a6fc028badee6ab9a4df2b1b395dbb701d965fb (diff)
downloadcygnal-9a089f21ea4862705c6c996502c089b8d18fc833.tar.gz
cygnal-9a089f21ea4862705c6c996502c089b8d18fc833.tar.bz2
cygnal-9a089f21ea4862705c6c996502c089b8d18fc833.zip
* cygheap.cc (init_cheap): Move username initialization.
(cygheap_init): Here. * shared_info.h (mount_info): Add a sys_mount_table_counter field. (shared_info): Ditto. * path.cc (mount_info::conv_to_win32_path): Check that our mount table is in sync with the system mount table and reinitialize it if not. (mount_info::add_reg_mount): Bump sys_mount_table counters if the system mount table changes. (mount_info::del_reg_mount): Ditto. (mount_info::write_cygdrive_info_to_registry): Ditto. (mount_info::remove_cygdrive_info_from_registry): Ditto.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r--winsup/cygwin/path.cc31
1 files changed, 26 insertions, 5 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 7bdf770da..20553920c 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -979,6 +979,11 @@ mount_info::conv_to_win32_path (const char *src_path, char *win32_path,
char *full_win32_path, DWORD &devn, int &unit,
unsigned *flags)
{
+ while (sys_mount_table_counter < cygwin_shared->sys_mount_table_counter)
+ {
+ init ();
+ sys_mount_table_counter++;
+ }
int src_path_len = strlen (src_path);
int trailing_slash_p = (src_path_len > 1
&& SLASH_P (src_path[src_path_len - 1]));
@@ -1485,6 +1490,9 @@ mount_info::add_reg_mount (const char * native_path, const char * posix_path, un
if (res != ERROR_SUCCESS)
goto err;
res = subkey.set_int ("flags", mountflags);
+
+ sys_mount_table_counter++;
+ cygwin_shared->sys_mount_table_counter++;
}
return 0; /* Success! */
@@ -1502,7 +1510,7 @@ mount_info::del_reg_mount (const char * posix_path, unsigned flags)
{
int res;
- if ((flags & MOUNT_SYSTEM) == 0) /* Delete from user registry */
+ if (!(flags & MOUNT_SYSTEM)) /* Delete from user registry */
{
reg_key reg_user (KEY_ALL_ACCESS,
CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME, NULL);
@@ -1510,6 +1518,8 @@ mount_info::del_reg_mount (const char * posix_path, unsigned flags)
}
else /* Delete from system registry */
{
+ sys_mount_table_counter++;
+ cygwin_shared->sys_mount_table_counter++;
reg_key reg_sys (HKEY_LOCAL_MACHINE, KEY_ALL_ACCESS, "SOFTWARE",
CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
CYGWIN_INFO_CYGWIN_REGISTRY_NAME,
@@ -1586,6 +1596,12 @@ mount_info::write_cygdrive_info_to_registry (const char *cygdrive_prefix, unsign
/* Determine whether to modify user or system cygdrive path prefix. */
HKEY top = (flags & MOUNT_SYSTEM) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ if (flags & MOUNT_SYSTEM)
+ {
+ sys_mount_table_counter++;
+ cygwin_shared->sys_mount_table_counter++;
+ }
+
/* reg_key for user path prefix in HKEY_CURRENT_USER or system path prefix in
HKEY_LOCAL_MACHINE. */
reg_key r (top, KEY_ALL_ACCESS, "SOFTWARE",
@@ -1621,8 +1637,7 @@ mount_info::write_cygdrive_info_to_registry (const char *cygdrive_prefix, unsign
appropriate:
1. setting user path prefix, or
2. overwriting (a previous) system path prefix */
- if ((flags & MOUNT_SYSTEM) == 0 ||
- (mount_table->cygdrive_flags & MOUNT_SYSTEM) != 0)
+ if (!(flags & MOUNT_SYSTEM) || (mount_table->cygdrive_flags & MOUNT_SYSTEM))
{
slashify (cygdrive_prefix, mount_table->cygdrive, 1);
mount_table->cygdrive_flags = flags;
@@ -1638,6 +1653,12 @@ mount_info::remove_cygdrive_info_from_registry (const char *cygdrive_prefix, uns
/* Determine whether to modify user or system cygdrive path prefix. */
HKEY top = (flags & MOUNT_SYSTEM) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ if (flags & MOUNT_SYSTEM)
+ {
+ sys_mount_table_counter++;
+ cygwin_shared->sys_mount_table_counter++;
+ }
+
/* reg_key for user path prefix in HKEY_CURRENT_USER or system path prefix in
HKEY_LOCAL_MACHINE. */
reg_key r (top, KEY_ALL_ACCESS, "SOFTWARE",
@@ -1728,7 +1749,7 @@ sort_by_posix_name (const void *a, const void *b)
if (res == 0)
{
/* need to select between user and system mount to same POSIX path */
- if ((bp->flags & MOUNT_SYSTEM) == 0) /* user mount */
+ if (!(bp->flags & MOUNT_SYSTEM)) /* user mount */
return 1;
else
return -1;
@@ -1764,7 +1785,7 @@ sort_by_native_name (const void *a, const void *b)
if (res == 0)
{
/* need to select between user and system mount to same POSIX path */
- if ((bp->flags & MOUNT_SYSTEM) == 0) /* user mount */
+ if (!(bp->flags & MOUNT_SYSTEM)) /* user mount */
return 1;
else
return -1;