mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 12:29:32 +08:00
* dcrt0.cc (dll_crt0_1): Move cxx_malloc reset kluge from here.
(check_sanity_and_sync): to here. * path.cc (has_dot_last_component): Rewrite to detect some corner cases that were previously uncaught.
This commit is contained in:
parent
182f0f0f8c
commit
284c5ea0a5
@ -1,3 +1,13 @@
|
|||||||
|
2009-10-02 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
|
* dcrt0.cc (dll_crt0_1): Move cxx_malloc reset kluge from here.
|
||||||
|
(check_sanity_and_sync): to here.
|
||||||
|
|
||||||
|
2009-09-30 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
|
* path.cc (has_dot_last_component): Rewrite to detect some corner cases
|
||||||
|
that were previously uncaught.
|
||||||
|
|
||||||
2009-09-30 Corinna Vinschen <corinna@vinschen.de>
|
2009-09-30 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler_console.cc (beep): Move up to avoid forward declaration.
|
* fhandler_console.cc (beep): Move up to avoid forward declaration.
|
||||||
|
@ -375,6 +375,12 @@ check_sanity_and_sync (per_process *p)
|
|||||||
if (p->api_major > cygwin_version.api_major)
|
if (p->api_major > cygwin_version.api_major)
|
||||||
api_fatal ("cygwin DLL and APP are out of sync -- API version mismatch %d > %d",
|
api_fatal ("cygwin DLL and APP are out of sync -- API version mismatch %d > %d",
|
||||||
p->api_major, cygwin_version.api_major);
|
p->api_major, cygwin_version.api_major);
|
||||||
|
|
||||||
|
/* This is a kludge to work around a version of _cygwin_common_crt0
|
||||||
|
which overwrote the cxx_malloc field with the local DLL copy.
|
||||||
|
Hilarity ensues if the DLL is not loaded while the process
|
||||||
|
is forking. */
|
||||||
|
__cygwin_user_data.cxx_malloc = &default_cygwin_cxx_malloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
child_info NO_COPY *child_proc_info = NULL;
|
child_info NO_COPY *child_proc_info = NULL;
|
||||||
@ -766,12 +772,6 @@ dll_crt0_1 (void *)
|
|||||||
sigproc_init ();
|
sigproc_init ();
|
||||||
check_sanity_and_sync (user_data);
|
check_sanity_and_sync (user_data);
|
||||||
|
|
||||||
/* This is a kludge to work around a version of _cygwin_common_crt0
|
|
||||||
which overwrote the cxx_malloc field with the local DLL copy.
|
|
||||||
Hilarity ensues if the DLL is not loaded like while the process
|
|
||||||
is forking. */
|
|
||||||
__cygwin_user_data.cxx_malloc = &default_cygwin_cxx_malloc;
|
|
||||||
|
|
||||||
/* Initialize malloc and then call user_shared_initialize since it relies
|
/* Initialize malloc and then call user_shared_initialize since it relies
|
||||||
on a functioning malloc and it's possible that the user's program may
|
on a functioning malloc and it's possible that the user's program may
|
||||||
have overridden malloc. We only know about that at this stage,
|
have overridden malloc. We only know about that at this stage,
|
||||||
|
@ -203,23 +203,32 @@ has_dot_last_component (const char *dir, bool test_dot_dot)
|
|||||||
/* SUSv3: . and .. are not allowed as last components in various system
|
/* SUSv3: . and .. are not allowed as last components in various system
|
||||||
calls. Don't test for backslash path separator since that's a Win32
|
calls. Don't test for backslash path separator since that's a Win32
|
||||||
path following Win32 rules. */
|
path following Win32 rules. */
|
||||||
const char *last_comp = strrchr (dir, '/');
|
const char *last_comp = strchr (dir, '\0');
|
||||||
if (!last_comp)
|
|
||||||
last_comp = dir;
|
if (last_comp == dir)
|
||||||
else {
|
return false; /* Empty string. Probably shouldn't happen here? */
|
||||||
/* Check for trailing slash. If so, hop back to the previous slash. */
|
|
||||||
if (!last_comp[1])
|
/* Detect run of trailing slashes */
|
||||||
while (last_comp > dir)
|
while (last_comp > dir && *--last_comp == '/')
|
||||||
if (*--last_comp == '/')
|
continue;
|
||||||
break;
|
|
||||||
if (*last_comp == '/')
|
/* Detect just a run of slashes or a path that does not end with a slash. */
|
||||||
++last_comp;
|
if (*last_comp != '.')
|
||||||
}
|
return false;
|
||||||
return last_comp[0] == '.'
|
|
||||||
&& ((last_comp[1] == '\0' || last_comp[1] == '/')
|
/* We know we have a trailing dot here. Check that it really is a standalone "."
|
||||||
|| (test_dot_dot
|
path component by checking that it is at the beginning of the string or is
|
||||||
&& last_comp[1] == '.'
|
preceded by a "/" */
|
||||||
&& (last_comp[2] == '\0' || last_comp[2] == '/')));
|
if (last_comp == dir || *--last_comp == '/')
|
||||||
|
return true;
|
||||||
|
|
||||||
|
/* If we're not checking for '..' we're done. Ditto if we're now pointing to
|
||||||
|
a non-dot. */
|
||||||
|
if (!test_dot_dot || *last_comp != '.')
|
||||||
|
return false; /* either not testing for .. or this was not '..' */
|
||||||
|
|
||||||
|
/* Repeat previous test for standalone or path component. */
|
||||||
|
return last_comp == dir || last_comp[-1] == '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Normalize a POSIX path.
|
/* Normalize a POSIX path.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user