From 105fbc5f7e4db2d39fb96e17d1e54790f94b06bb Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Mon, 17 Aug 2020 19:16:03 +0100 Subject: [PATCH] launch, launcher: Clarify Signed-off-by: Simon McVittie <smcv@collabora.com> --- src/launch.c | 16 ++++++++-------- src/launcher.c | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/launch.c b/src/launch.c index a3315ba7e..1bb80980e 100644 --- a/src/launch.c +++ b/src/launch.c @@ -67,23 +67,23 @@ process_exited_cb (G_GNUC_UNUSED GDBusConnection *connection, { GMainLoop *loop = user_data; guint32 client_pid = 0; - guint32 exit_status = 0; + guint32 wait_status = 0; if (!g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(uu)"))) return; - g_variant_get (parameters, "(uu)", &client_pid, &exit_status); - g_debug ("child exited %d: %d", client_pid, exit_status); + g_variant_get (parameters, "(uu)", &client_pid, &wait_status); + g_debug ("child %d exited: wait status %d", client_pid, wait_status); if (child_pid == client_pid) { int exit_code = 0; - if (WIFEXITED (exit_status)) + if (WIFEXITED (wait_status)) { - exit_code = WEXITSTATUS (exit_status); + exit_code = WEXITSTATUS (wait_status); } - else if (WIFSIGNALED (exit_status)) + else if (WIFSIGNALED (wait_status)) { /* Smush the signal into an unsigned byte, as the shell does. This is * not quite right from the perspective of whatever ran flatpak-spawn @@ -91,7 +91,7 @@ process_exited_cb (G_GNUC_UNUSED GDBusConnection *connection, * alternative is to disconnect all signal() handlers then send this * signal to ourselves and hope it kills us. */ - exit_code = 128 + WTERMSIG (exit_status); + exit_code = 128 + WTERMSIG (wait_status); } else { @@ -100,7 +100,7 @@ process_exited_cb (G_GNUC_UNUSED GDBusConnection *connection, * of WIFEXITED() or WIFSIGNALED() will be true. */ g_warning ("exit status %d is neither WIFEXITED() nor WIFSIGNALED()", - exit_status); + wait_status); exit_code = LAUNCH_EX_CANNOT_REPORT; } diff --git a/src/launcher.c b/src/launcher.c index baf0c6637..8b359c30b 100644 --- a/src/launcher.c +++ b/src/launcher.c @@ -135,7 +135,7 @@ child_watch_died (GPid pid, PidData *pid_data = user_data; g_autoptr(GVariant) signal_variant = NULL; - g_debug ("Client Pid %d died", pid_data->pid); + g_debug ("Child %d died: wait status %d", pid_data->pid, status); signal_variant = g_variant_ref_sink (g_variant_new ("(uu)", pid, status)); g_dbus_connection_emit_signal (pid_data->connection, -- GitLab