[gimp] libgimpbase: in gimp_stack_trace_print(), shuffle some code around
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpbase: in gimp_stack_trace_print(), shuffle some code around
- Date: Mon, 5 Mar 2018 07:34:30 +0000 (UTC)
commit 86939d847f946a3e99d582d01ddfbb724abb33f8
Author: Ell <ell_se yahoo com>
Date: Mon Mar 5 02:31:00 2018 -0500
libgimpbase: in gimp_stack_trace_print(), shuffle some code around
Reap the child *after* we're done reading its output, so that we
can disable ptracing after reading, but before reaping. This
avoids a window during which the child is gone, but ptracing using
its PID is still allowed.
libgimpbase/gimputils.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/libgimpbase/gimputils.c b/libgimpbase/gimputils.c
index d40b4f2..4b7c14f 100644
--- a/libgimpbase/gimputils.c
+++ b/libgimpbase/gimputils.c
@@ -1250,13 +1250,6 @@ gimp_stack_trace_print (const gchar *prog_name,
*/
close (out_fd[1]);
- waitpid (pid, &status, 0);
-
-#ifdef PR_SET_PTRACER
- /* Clear ptrace permission set above */
- prctl (PR_SET_PTRACER, 0, 0, 0, 0);
-#endif
-
while ((read_n = read (out_fd[0], buffer, 256)) > 0)
{
/* It's hard to know if the debugger was found since it
@@ -1276,6 +1269,13 @@ gimp_stack_trace_print (const gchar *prog_name,
}
}
close (out_fd[0]);
+
+#ifdef PR_SET_PTRACER
+ /* Clear ptrace permission set above */
+ prctl (PR_SET_PTRACER, 0, 0, 0, 0);
+#endif
+
+ waitpid (pid, &status, 0);
}
/* else if (pid == (pid_t) -1)
* Fork failed!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]