From 7dc9d374e1ab926ffda760c8b778271eaca12793 Mon Sep 17 00:00:00 2001 From: "H. Vetinari" Date: Thu, 22 Aug 2024 11:46:52 +1100 Subject: [PATCH] fixes --- recipe/win_forwarder.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/recipe/win_forwarder.c b/recipe/win_forwarder.c index 951fc741..03bf770a 100644 --- a/recipe/win_forwarder.c +++ b/recipe/win_forwarder.c @@ -19,7 +19,12 @@ int _tmain( int argc, TCHAR *argv[] ) char forwarded[32767]; // the first element is the name of the calling function, which we extend strcat(forwarded, argv[0]); - strcat(forwarded, "-{{ majorversion }}"); + // chop off ".exe" (if the binary we're in was invoked like that) + unsigned int len = strlen(argv[0]); + if (len > 4 && strcmp(&forwarded[len-4], ".exe") == 0) + // set nul-terminator to finish the string early + forwarded[len-4] = '\0'; + strcat(forwarded, "-{{ majorversion }}.exe"); // rest stays the same for (int i = 1; i < argc; i++) { strcat(forwarded, " ");