Blob Blame History Raw
From 325577feffad1f87b07d92710c0d37c79c5f50a1 Mon Sep 17 00:00:00 2001
From: Ryan Lucia <rylucia@microsoft.com>
Date: Thu, 4 Feb 2021 08:55:48 -0500
Subject: [PATCH] Fix early return in Process.Start

---
 mono/metadata/w32process-unix.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mono/metadata/w32process-unix.c b/mono/metadata/w32process-unix.c
index 663cc6ff5111..d030101aede6 100644
--- a/mono/metadata/w32process-unix.c
+++ b/mono/metadata/w32process-unix.c
@@ -2032,6 +2032,9 @@ ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStar
 
 		static char *handler;
 		static gunichar2 *handler_utf16;
+#ifndef HOST_DARWIN
+		gboolean finished = FALSE;
+#endif
 
 		if (handler_utf16 == (gunichar2 *)-1) {
 			ret = FALSE;
@@ -2057,6 +2060,7 @@ ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStar
 				if (handler == NULL){
 					handler_utf16 = (gunichar2 *) -1;
 					ret = FALSE;
+					finished = TRUE;
 				} else {
 					/* kfmclient needs exec argument */
 					char *old = handler;
@@ -2067,9 +2071,8 @@ ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStar
 			}
 		}
 		MONO_EXIT_GC_SAFE;
-		if (ret == FALSE){
+		if (finished)
 			goto done;
-		}
 #endif
 		handler_utf16 = g_utf8_to_utf16 (handler, -1, NULL, NULL, NULL);
 		g_free (handler);