summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 2d44d21aca..12293b416d 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -2210,7 +2210,7 @@ void mingw_startup(void)
die_startup();
/* determine size of argv and environ conversion buffer */
- maxlen = wcslen(_wpgmptr);
+ maxlen = wcslen(wargv[0]);
for (i = 1; i < argc; i++)
maxlen = max(maxlen, wcslen(wargv[i]));
for (i = 0; wenv[i]; i++)
@@ -2230,8 +2230,7 @@ void mingw_startup(void)
buffer = malloc_startup(maxlen);
/* convert command line arguments and environment to UTF-8 */
- __argv[0] = wcstoutfdup_startup(buffer, _wpgmptr, maxlen);
- for (i = 1; i < argc; i++)
+ for (i = 0; i < argc; i++)
__argv[i] = wcstoutfdup_startup(buffer, wargv[i], maxlen);
for (i = 0; wenv[i]; i++)
environ[i] = wcstoutfdup_startup(buffer, wenv[i], maxlen);