File fix-daemon-reload-reaping.patch of Package systemd.openSUSE_12.1_Update

From ec3f9b53f882623e6572258ba15234b1ee108b7f Mon Sep 17 00:00:00 2001
From: Chris Paulson-Ellis <chris@edesix.com>
Date: Thu, 2 Feb 2012 17:32:05 +0000
Subject: [PATCH] util: prevent daemon-reload from reaping service processes.

The reaping of generator processes run as part of a daemon-reload should not
call waitid(PID_ALL). The waitid() call in execute_directory() is intended only
to reap the executed processes, but if a service process exits at about the
same time as a daemon-reload, then that service process is reaped as well,
preventing it from being reaped in the proper place in
manager_dispatch_sigchld().

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=43625
---
 src/util.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/util.c b/src/util.c
index 58a0aeb..11f77ab 100644
--- a/src/util.c
+++ b/src/util.c
@@ -4623,11 +4623,12 @@ void execute_directory(const char *directory, DIR *d, char *argv[]) {
         }
 
         while (!hashmap_isempty(pids)) {
+                pid_t pid = PTR_TO_UINT(hashmap_first_key(pids));
                 siginfo_t si;
                 char *path;
 
                 zero(si);
-                if (waitid(P_ALL, 0, &si, WEXITED) < 0) {
+                if (waitid(P_PID, pid, &si, WEXITED) < 0) {
 
                         if (errno == EINTR)
                                 continue;
-- 
1.7.7

From 2e4a6ff47b311216829ed0f48f17ee9bc35641dc Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 19 Dec 2011 19:54:51 +0100
Subject: [PATCH] hashmap: add hashmap_first_key()

---
 src/hashmap.c |   11 +++++++++++
 src/hashmap.h |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/hashmap.c b/src/hashmap.c
index 95ea45d..7ef8097 100644
--- a/src/hashmap.c
+++ b/src/hashmap.c
@@ -558,6 +558,17 @@ void* hashmap_first(Hashmap *h) {
         return h->iterate_list_head->value;
 }
 
+void* hashmap_first_key(Hashmap *h) {
+
+        if (!h)
+                return NULL;
+
+        if (!h->iterate_list_head)
+                return NULL;
+
+        return (void*) h->iterate_list_head->key;
+}
+
 void* hashmap_last(Hashmap *h) {
 
         if (!h)
diff --git a/src/hashmap.h b/src/hashmap.h
index 16ffbd3..ab4363a 100644
--- a/src/hashmap.h
+++ b/src/hashmap.h
@@ -74,6 +74,7 @@ void hashmap_clear(Hashmap *h);
 void *hashmap_steal_first(Hashmap *h);
 void *hashmap_steal_first_key(Hashmap *h);
 void* hashmap_first(Hashmap *h);
+void* hashmap_first_key(Hashmap *h);
 void* hashmap_last(Hashmap *h);
 
 char **hashmap_get_strv(Hashmap *h);
-- 
1.7.7

openSUSE Build Service is sponsored by