* cygheap.cc (cygheap_root::cygheap_rot): Remove constructor.

(cygheap_root::~cygheap_root): Remove destructor.
(cygheap_root::operator =): Remove.
(cygheap_root::set): New method.
* cygheap.h (cygheap_root): Reflect above changes.  Store root info in
mount-like structure.
(cygheap_root:posix_ok): New method.
(cygheap_root::ischroot_native): Ditto.
(cygheap_root::unchroot): Ditto.
(cygheap_root::exists): Ditto.
(cygheap_root::posix_length): Ditto.
(cygheap_root::posix_path): Ditto.
(cygheap_root::native_length): Ditto.
(cygheap_root::native_path): Ditto.
* dir.cc (opendir): Remove special chroot test.
* path.cc (path_prefix_p): Remove front end.
(normalize_posix_path): Reorganize chroot tests to accomodate new convention of
allowing paths using posix chroot prefix.
(path_conv::check): Pass a "already ran normalize" option to
conv_to_win32_path.  Return if there is an error from this function.
(mount_info::conv_to_win32_path): Add extra argument.  Don't call
normalize_posix_path if caller has already done so.  Substitute chroot setting,
if any, for root translation.  Add chroot checking to final output step.
* shared_info (mount_info): Accomodate additional argument to
conv_to_win32_path.
* syscalls.cc (chroot): Store both normalized posix path and native path in
chroot.
This commit is contained in:
Christopher Faylor
2001-06-03 02:31:16 +00:00
parent bb8251474c
commit 7ceb1cac3a
7 changed files with 200 additions and 137 deletions

View File

@@ -290,40 +290,20 @@ cstrdup1 (const char *s)
return p;
}
cygheap_root::cygheap_root (cygheap_root &nroot)
void
cygheap_root::set (const char *posix, const char *native)
{
rootlen = nroot.rootlen;
root = nroot.root ? cstrdup (nroot.root) : NULL;
}
if (!m)
m = (struct cygheap_root_mount_info *) ccalloc (HEAP_MOUNT, 1, sizeof (*m));
strcpy (m->posix_path, posix);
m->posix_pathlen = strlen (posix);
if (m->posix_pathlen >= 1 && m->posix_path[m->posix_pathlen - 1] == '/')
m->posix_path[--m->posix_pathlen] = '\0';
cygheap_root::~cygheap_root ()
{
if (root)
cfree (root);
}
char *
cygheap_root::operator =(const char *new_root)
{
if (root)
{
cfree (root);
root = NULL;
}
rootlen = 0;
if (new_root && *new_root)
{
root = cstrdup (new_root);
rootlen = strlen (root);
if (rootlen >= 1 && root[rootlen - 1] == '/')
root[--rootlen] = '\0';
if (!rootlen)
{
cfree (root);
root = NULL;
}
}
return root;
strcpy (m->native_path, native);
m->native_pathlen = strlen (native);
if (m->native_pathlen >= 1 && m->native_path[m->native_pathlen - 1] == '\\')
m->native_path[--m->native_pathlen] = '\0';
}
cygheap_user::~cygheap_user ()