Blame SOURCES/0001-_dbus_babysitter_unref-avoid-infinite-loop-if-waitpi.patch

f8e34b
From a4f11f83a4b8ba8c7feecd37c7606d0d792d7fe6 Mon Sep 17 00:00:00 2001
f8e34b
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
f8e34b
Date: Wed, 4 Sep 2013 17:53:23 +0100
f8e34b
Subject: [PATCH] _dbus_babysitter_unref: avoid infinite loop if waitpid()
f8e34b
 returns EINTR
f8e34b
f8e34b
If waitpid() failed with EINTR, we'd go back for another go, but
f8e34b
because ret is nonzero, we'd skip the waitpid() and just keep looping.
f8e34b
f8e34b
Also avoid an unnecessary "goto" in favour of a proper loop, to make it
f8e34b
more clearly correct.
f8e34b
f8e34b
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=68945
f8e34b
---
f8e34b
 dbus/dbus-spawn.c | 13 ++++++++-----
f8e34b
 1 file changed, 8 insertions(+), 5 deletions(-)
f8e34b
f8e34b
diff --git a/dbus/dbus-spawn.c b/dbus/dbus-spawn.c
f8e34b
index ef00801..6e42f55 100644
f8e34b
--- a/dbus/dbus-spawn.c
f8e34b
+++ b/dbus/dbus-spawn.c
f8e34b
@@ -308,15 +308,18 @@ _dbus_babysitter_unref (DBusBabysitter *sitter)
f8e34b
           if (ret == 0)
f8e34b
             kill (sitter->sitter_pid, SIGKILL);
f8e34b
 
f8e34b
-        again:
f8e34b
           if (ret == 0)
f8e34b
-            ret = waitpid (sitter->sitter_pid, &status, 0);
f8e34b
+            {
f8e34b
+              do
f8e34b
+                {
f8e34b
+                  ret = waitpid (sitter->sitter_pid, &status, 0);
f8e34b
+                }
f8e34b
+              while (_DBUS_UNLIKELY (ret < 0 && errno == EINTR));
f8e34b
+            }
f8e34b
 
f8e34b
           if (ret < 0)
f8e34b
             {
f8e34b
-              if (errno == EINTR)
f8e34b
-                goto again;
f8e34b
-              else if (errno == ECHILD)
f8e34b
+              if (errno == ECHILD)
f8e34b
                 _dbus_warn ("Babysitter process not available to be reaped; should not happen\n");
f8e34b
               else
f8e34b
                 _dbus_warn ("Unexpected error %d in waitpid() for babysitter: %s\n",
f8e34b
-- 
f8e34b
1.8.4.rc3
f8e34b