diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2000-11-15 00:13:09 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2000-11-15 00:13:09 +0000 |
commit | 1f0f8e127c6a6fd7520ebc08eb2f479507247d5f (patch) | |
tree | 8ae38247dfc47ad5ebfdc0b5f8c93d700179deb0 /winsup/cygwin/path.cc | |
parent | fe8c097112ab4e2cd2c369b484561c0bd4ce4b75 (diff) | |
download | cygnal-1f0f8e127c6a6fd7520ebc08eb2f479507247d5f.tar.gz cygnal-1f0f8e127c6a6fd7520ebc08eb2f479507247d5f.tar.bz2 cygnal-1f0f8e127c6a6fd7520ebc08eb2f479507247d5f.zip |
* cygheap.cc (cygheap_root::cygheap_root): New function.
(cygheap_root::~cygheap_root): Ditto.
(cygheap_root::operator=): Ditto.
(cygheap_user::~cygheap_user): Ditto.
(cygheap_user::set_name): Ditto.
(cygheap_user::set_logsrv): Ditto.
(cygheap_user::set_domain): Ditto.
(cygheap_user::set_sid): Ditto.
* cygheap.h (cygheap_root): New class.
(cygheap_user): Ditto.
(init_cygheap): Change type of `root' member to cygheap_root.
Add `user' member.
* dir.cc (opendir): Use new `cygheap_root' class.
* dcrt0.cc (dll_crt0_1): Use new `cygheap_user' class.
* fork.cc (fork_parent): Ditto.
* grp.cc (getgroups): Ditto.
* passwd.cc (search_for): Ditto.
* path.cc: Use new `cygheap_root' class throughout.
* pinfo.h (_pinfo): Remove `use_psid'. Move `username', `psid',
`logsrv', `domain', `orig_{uid,gid}' and `real_{uid,gid}' to
cygheap_user class.
* security.cc: Use new `cygheap_user' class throughout.
* shared.cc (sec_user): Ditto.
* sigproc.cc (proc_subproc): Remove copy statements for user
related information moved to `cygheap_user' class.
* spawn.cc (spawn_guts): Invalidate current chroot settings
when creating Windows environment. Use new `cygheap_user' class.
* syscalls.cc: Use new `cygheap_user' class throughout.
* uinfo.cc: Ditto.
* uinfo.cc (internal_getlogin): Change parameters to reflect the
move of user information to cygheap.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r-- | winsup/cygwin/path.cc | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index b415afa5a..b878920f7 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -109,10 +109,11 @@ cwdstuff cygcwd; /* The current working directory. */ (isdirsep(path[cygwin_shared->mount.cygdrive_len + 1]) || \ !path[cygwin_shared->mount.cygdrive_len + 1])) -#define ischrootpath(path) \ - (cygheap->rootlen && \ - strncasematch (cygheap->root, path, cygheap->rootlen) && \ - (path[cygheap->rootlen] == '/' || path[cygheap->rootlen] == '\0')) +#define ischrootpath(p) \ + (cygheap->root.length () && \ + strncasematch (cygheap->root.path (), p, cygheap->root.length ()) && \ + (p[cygheap->root.length ()] == '/' \ + || p[cygheap->root.length ()] == '\0')) /* Return non-zero if PATH1 is a prefix of PATH2. Both are assumed to be of the same path style and / vs \ usage. @@ -615,7 +616,7 @@ normalize_posix_path (const char *src, char *dst) /* Two leading /'s? If so, preserve them. */ else if (isslash (src[1])) { - if (cygheap->rootlen) + if (cygheap->root.length ()) { debug_printf ("ENOENT = normalize_posix_path (%s)", src); return ENOENT; @@ -631,10 +632,10 @@ normalize_posix_path (const char *src, char *dst) } } /* Exactly one leading slash. Absolute path. Check for chroot. */ - else if (cygheap->rootlen) + else if (cygheap->root.length ()) { - strcpy (dst, cygheap->root); - dst += cygheap->rootlen; + strcpy (dst, cygheap->root.path ()); + dst += cygheap->root.length (); } while (*src) @@ -669,7 +670,7 @@ normalize_posix_path (const char *src, char *dst) else { if (!ischrootpath (dst_start) || - dst - dst_start != (int) cygheap->rootlen) + dst - dst_start != (int) cygheap->root.length ()) while (dst > dst_start && !isslash (*--dst)) continue; src++; @@ -718,7 +719,7 @@ normalize_win32_path (const char *src, char *dst) /* Two leading \'s? If so, preserve them. */ else if (SLASH_P (src[0]) && SLASH_P (src[1])) { - if (cygheap->rootlen) + if (cygheap->root.length ()) { debug_printf ("ENOENT = normalize_win32_path (%s)", src); return ENOENT; @@ -727,13 +728,13 @@ normalize_win32_path (const char *src, char *dst) ++src; } /* If absolute path, care for chroot. */ - else if (SLASH_P (src[0]) && !SLASH_P (src[1]) && cygheap->rootlen) + else if (SLASH_P (src[0]) && !SLASH_P (src[1]) && cygheap->root.length ()) { - strcpy (dst, cygheap->root); + strcpy (dst, cygheap->root.path ()); char *c; while ((c = strchr (dst, '/')) != NULL) *c = '\\'; - dst += cygheap->rootlen; + dst += cygheap->root.length (); dst_root_start = dst; *dst++ = '\\'; } @@ -997,7 +998,7 @@ mount_info::conv_to_win32_path (const char *src_path, char *win32_path, } isrelpath = !isabspath (src_path); *flags = set_flags_from_win32_path (dst); - if (cygheap->rootlen && dst[0] && dst[1] == ':') + if (cygheap->root.length () && dst[0] && dst[1] == ':') { char posix_path[MAX_PATH + 1]; @@ -2939,9 +2940,10 @@ cwdstuff::get (char *buf, int need_posix, int with_chroot, unsigned ulen) tocopy = win32; else tocopy = with_chroot && ischrootpath(posix) ? - posix + cygheap->rootlen : posix; + posix + cygheap->root.length () : posix; - debug_printf("cygheap->root: %s, posix: %s", cygheap->root, posix); + debug_printf("cygheap->root: %s, posix: %s", + (const char *) cygheap->root.path (), posix); if (strlen (tocopy) >= ulen) { set_errno (ERANGE); |