File 0888-Fix-erlang-open_port-spawn_executable-_-_-on-Windows.patch of Package erlang

From b9223c1f0bfe02194bbf72e5c34517d6e6a2a5a4 Mon Sep 17 00:00:00 2001
From: Raimo Niskanen <raimo@erlang.org>
Date: Wed, 2 Mar 2022 17:15:17 +0100
Subject: [PATCH 1/2] Fix erlang:open_port({spawn_executable,_},_) on Windows

Use the looked up absolute program name instead of (incorrectly)
spawning the pre-lookup command from the path.

Remove redundant incorrect command line quoting.
---
 erts/emulator/sys/win32/sys.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/erts/emulator/sys/win32/sys.c b/erts/emulator/sys/win32/sys.c
index c673619a5b..2a41222275 100644
--- a/erts/emulator/sys/win32/sys.c
+++ b/erts/emulator/sys/win32/sys.c
@@ -1593,7 +1593,7 @@ create_child_process
 	wcscat(newcmdline, execPath);
 	wcscat(newcmdline, origcmd+cmdlength);
 	DEBUGF(("Creating child process: %S, createFlags = %d\n", newcmdline, createFlags));
-	ok = CreateProcessW(appname,
+	ok = CreateProcessW(execPath,
 			    newcmdline,
 			    NULL,
 			    NULL,
@@ -1945,14 +1945,6 @@ static int application_type (const wchar_t *originalName, /* Name of the applica
 
 	GetShortPathNameW(wfullpath, wfullpath, MAX_PATH);
     }
-    if (is_quoted) {
-	/* restore quotes on quoted program name */
-	len = wcslen(wfullpath);
-	memmove(wfullpath+1,wfullpath,len*sizeof(wchar_t));
-	wfullpath[0]=L'"';
-	wfullpath[len+1]=L'"';
-	wfullpath[len+2]=L'\0';
-    }
     return applType;
 }
 
-- 
2.34.1

openSUSE Build Service is sponsored by