2004-09-05 Pierre Humblet <pierre.humblet@ieee.org>
* cygheap.h (cwdstuff::drive_length): New member. (cwdstuff::get_drive): New method. * path.cc (normalize_win32_path): Simplify by using cwdstuff::get_drive. (mount_info::conv_to_win32_path): Use cwdstuff::get_drive as default for /. (cwdstuff::set): Initialize drive_length.
This commit is contained in:
parent
b00c5f99d8
commit
a456320915
|
@ -1,3 +1,11 @@
|
||||||
|
2004-09-08 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
|
* cygheap.h (cwdstuff::drive_length): New member.
|
||||||
|
(cwdstuff::get_drive): New method.
|
||||||
|
* path.cc (normalize_win32_path): Simplify by using cwdstuff::get_drive.
|
||||||
|
(mount_info::conv_to_win32_path): Use cwdstuff::get_drive as default for /.
|
||||||
|
(cwdstuff::set): Initialize drive_length.
|
||||||
|
|
||||||
2004-09-07 Christopher Faylor <cgf@timesys.com>
|
2004-09-07 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
* cygtls.cc (_cygtls::init_thread): Set __sdidinit to negative value to
|
* cygtls.cc (_cygtls::init_thread): Set __sdidinit to negative value to
|
||||||
|
|
|
@ -216,9 +216,16 @@ struct cwdstuff
|
||||||
char *posix;
|
char *posix;
|
||||||
char *win32;
|
char *win32;
|
||||||
DWORD hash;
|
DWORD hash;
|
||||||
|
DWORD drive_length;
|
||||||
muto *cwd_lock;
|
muto *cwd_lock;
|
||||||
char *get (char *, int = 1, int = 0, unsigned = CYG_MAX_PATH);
|
char *get (char *, int = 1, int = 0, unsigned = CYG_MAX_PATH);
|
||||||
DWORD get_hash ();
|
DWORD get_hash ();
|
||||||
|
DWORD get_drive (char * dst)
|
||||||
|
{
|
||||||
|
get_initial ();
|
||||||
|
memcpy (dst, win32, drive_length);
|
||||||
|
return drive_length;
|
||||||
|
}
|
||||||
void init ();
|
void init ();
|
||||||
void fixup_after_exec (char *, char *, DWORD);
|
void fixup_after_exec (char *, char *, DWORD);
|
||||||
bool get_initial ();
|
bool get_initial ();
|
||||||
|
|
|
@ -980,28 +980,16 @@ normalize_win32_path (const char *src, char *dst, char **tail)
|
||||||
}
|
}
|
||||||
else if (strchr (src, ':') == NULL && *src != '/')
|
else if (strchr (src, ':') == NULL && *src != '/')
|
||||||
{
|
{
|
||||||
if (!cygheap->cwd.get (dst, 0))
|
|
||||||
return get_errno ();
|
|
||||||
if (beg_src_slash)
|
if (beg_src_slash)
|
||||||
|
dst += cygheap->cwd.get_drive (dst);
|
||||||
|
else if (!cygheap->cwd.get (dst, 0))
|
||||||
|
return get_errno ();
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (dst[1] == ':')
|
|
||||||
dst[2] = '\0';
|
|
||||||
else if (is_unc_share (dst))
|
|
||||||
{
|
|
||||||
char *p = strpbrk (dst + 2, "\\/");
|
|
||||||
if (p && (p = strpbrk (p + 1, "\\/")))
|
|
||||||
*p = '\0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (strlen (dst) + 1 + strlen (src) >= CYG_MAX_PATH)
|
|
||||||
{
|
|
||||||
debug_printf ("ENAMETOOLONG = normalize_win32_path (%s)", src);
|
|
||||||
return ENAMETOOLONG;
|
|
||||||
}
|
|
||||||
dst += strlen (dst);
|
dst += strlen (dst);
|
||||||
if (!beg_src_slash)
|
|
||||||
*dst++ = '\\';
|
*dst++ = '\\';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (*src)
|
while (*src)
|
||||||
{
|
{
|
||||||
|
@ -1521,8 +1509,12 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, device& dev,
|
||||||
chroot_ok = true;
|
chroot_ok = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
backslashify (src_path, dst, 0);
|
{
|
||||||
|
int offset = 0;
|
||||||
|
if (src_path[1] != '/' && src_path[1] != ':')
|
||||||
|
offset = cygheap->cwd.get_drive (dst);
|
||||||
|
backslashify (src_path, dst + offset, 0);
|
||||||
|
}
|
||||||
out:
|
out:
|
||||||
MALLOC_CHECK;
|
MALLOC_CHECK;
|
||||||
if (chroot_ok || cygheap->root.ischroot_native (dst))
|
if (chroot_ok || cygheap->root.ischroot_native (dst))
|
||||||
|
@ -3705,6 +3697,17 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit)
|
||||||
win32 = (char *) crealloc (win32, strlen (win32_cwd) + 1);
|
win32 = (char *) crealloc (win32, strlen (win32_cwd) + 1);
|
||||||
strcpy (win32, win32_cwd);
|
strcpy (win32, win32_cwd);
|
||||||
}
|
}
|
||||||
|
if (win32[1] == ':')
|
||||||
|
drive_length = 2;
|
||||||
|
else if (win32[1] == '\\')
|
||||||
|
{
|
||||||
|
char * ptr = strechr (win32 + 2, '\\');
|
||||||
|
if (*ptr)
|
||||||
|
ptr = strechr (ptr + 1, '\\');
|
||||||
|
drive_length = ptr - win32;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
drive_length = 0;
|
||||||
|
|
||||||
if (!posix_cwd)
|
if (!posix_cwd)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue