From 16b41ef2547963b056148eabf91a6821c73cd304 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Mon, 2 Nov 2015 21:56:32 +0100 Subject: [PATCH] Fix warning: variable 'ret' set but not used [-Wunused-but-set-variable]. Only set valid child status in case exit code has been gotten from child process, otherwise signal failure through thread return value. --- dbus/dbus-spawn-win.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dbus/dbus-spawn-win.c b/dbus/dbus-spawn-win.c index 7f68f14..faf1ab4 100644 --- a/dbus/dbus-spawn-win.c +++ b/dbus/dbus-spawn-win.c @@ -616,13 +616,16 @@ babysitter (void *parameter) DWORD status; PING(); + // wait until process finished WaitForSingleObject (sitter->child_handle, INFINITE); PING(); ret = GetExitCodeProcess (sitter->child_handle, &status); - - sitter->child_status = status; - sitter->have_child_status = TRUE; + if (ret) + { + sitter->child_status = status; + sitter->have_child_status = TRUE; + } CloseHandle (sitter->child_handle); sitter->child_handle = NULL; @@ -637,7 +640,7 @@ babysitter (void *parameter) _dbus_babysitter_unref (sitter); - return 0; + return ret ? 0 : 1; } dbus_bool_t -- 1.8.4.5