mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 20:39:33 +08:00
* dcrt0.cc (dll_crt0_1): Copy argv before passing to main().
This commit is contained in:
parent
e4257c7366
commit
ce68abe0b4
@ -1,3 +1,7 @@
|
||||
2011-10-17 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||
|
||||
* dcrt0.cc (dll_crt0_1): Copy argv before passing to main().
|
||||
|
||||
2011-10-17 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||
|
||||
* sigproc.cc (proc_terminate): Avoid setting ppid to 1 if we're execing.
|
||||
|
@ -894,7 +894,18 @@ dll_crt0_1 (void *)
|
||||
_setlocale_r (_REENT, LC_CTYPE, "C");
|
||||
|
||||
if (user_data->main)
|
||||
cygwin_exit (user_data->main (__argc, __argv, *user_data->envptr));
|
||||
{
|
||||
/* Create a copy of Cygwin's version of __argv so that, if the user makes
|
||||
a change to an element of argv[] it does not affect Cygwin's argv.
|
||||
Changing the the contents of what argv[n] points to will still
|
||||
affect Cygwin. This is similar (but not exactly like) Linux. */
|
||||
char *newargv[__argc + 1];
|
||||
char **nav = newargv;
|
||||
char **oav = __argv;
|
||||
while ((*nav++ = *oav++) != NULL)
|
||||
continue;
|
||||
cygwin_exit (user_data->main (__argc, newargv, *user_data->envptr));
|
||||
}
|
||||
__asm__ (" \n\
|
||||
.global __cygwin_exit_return \n\
|
||||
__cygwin_exit_return: \n\
|
||||
|
Loading…
x
Reference in New Issue
Block a user