Skip to content

Commit 86e2545

Browse files
dschogitster
authored andcommitted
mingw/msvc: use the new-style RUNTIME_PREFIX helper
This change also allows us to stop overriding argv[0] with the absolute path of the executable, allowing us to preserve e.g. the case of the executable's file name. This fixes git-for-windows#1496 partially. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent c1be1cb commit 86e2545

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

compat/mingw.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,7 +2221,7 @@ void mingw_startup(void)
22212221
die_startup();
22222222

22232223
/* determine size of argv and environ conversion buffer */
2224-
maxlen = wcslen(_wpgmptr);
2224+
maxlen = wcslen(wargv[0]);
22252225
for (i = 1; i < argc; i++)
22262226
maxlen = max(maxlen, wcslen(wargv[i]));
22272227
for (i = 0; wenv[i]; i++)
@@ -2241,8 +2241,7 @@ void mingw_startup(void)
22412241
buffer = malloc_startup(maxlen);
22422242

22432243
/* convert command line arguments and environment to UTF-8 */
2244-
__argv[0] = wcstoutfdup_startup(buffer, _wpgmptr, maxlen);
2245-
for (i = 1; i < argc; i++)
2244+
for (i = 0; i < argc; i++)
22462245
__argv[i] = wcstoutfdup_startup(buffer, wargv[i], maxlen);
22472246
for (i = 0; wenv[i]; i++)
22482247
environ[i] = wcstoutfdup_startup(buffer, wenv[i], maxlen);

config.mak.uname

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ ifeq ($(uname_S),Windows)
357357
SNPRINTF_RETURNS_BOGUS = YesPlease
358358
NO_SVN_TESTS = YesPlease
359359
RUNTIME_PREFIX = YesPlease
360+
HAVE_WPGMPTR = YesWeDo
360361
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
361362
NO_NSEC = YesPlease
362363
USE_WIN32_MMAP = YesPlease
@@ -506,6 +507,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))
506507
NO_SVN_TESTS = YesPlease
507508
NO_PERL_MAKEMAKER = YesPlease
508509
RUNTIME_PREFIX = YesPlease
510+
HAVE_WPGMPTR = YesWeDo
509511
NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
510512
NO_NSEC = YesPlease
511513
USE_WIN32_MMAP = YesPlease

0 commit comments

Comments
 (0)