~ubuntu-branches/ubuntu/utopic/pacemaker/utopic-proposed

« back to all changes in this revision

Viewing changes to debian/patches/gracefully_handle_ECHILD_in_waitpid.patch

  • Committer: Package Import Robot
  • Author(s): Liam Young
  • Date: 2014-08-01 15:27:42 UTC
  • mfrom: (2.1.25 sid)
  • Revision ID: package-import@ubuntu.com-20140801152742-7crx0jtcwz4k2l45
Tags: 1.1.10+git20130802-4ubuntu1
* Merge from Debian unstable (LP: #1351307).  Remaining changes:
  - debian/control: Build-Depends on libcfg-dev; Depends on libheartbeat2.
* Corosync's pacemaker plugin is disabled, hence not built:
  - debian/licrmcluster4-dev.install: Do not install plugin.h.
  - debian/pacemaker.install: Do not install pacemaker.lcrso.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff --git a/lib/common/utils.c b/lib/common/utils.c
 
2
index 527c9e0..b45e620 100644
 
3
--- a/lib/common/utils.c
 
4
+++ b/lib/common/utils.c
 
5
@@ -1118,31 +1118,36 @@
 
6
         crm_err("%s: Triggered fatal assert at %s:%d : %s", function, file, line, assert_condition);
 
7
     }
 
8
 
 
9
-    switch (pid) {
 
10
-        case -1:
 
11
-            crm_crit("%s: Cannot create core for non-fatal assert at %s:%d : %s",
 
12
-                     function, file, line, assert_condition);
 
13
-            return;
 
14
-
 
15
-        case 0:                /* Child */
 
16
-            abort();
 
17
-            break;
 
18
+    if (pid == -1) {
 
19
+        crm_crit("%s: Cannot create core for non-fatal assert at %s:%d : %s",
 
20
+                 function, file, line, assert_condition);
 
21
+        return;
 
22
+
 
23
+    } else if(pid == 0) {
 
24
+        /* Child process */
 
25
+        abort();
 
26
+        return;
 
27
+    }
 
28
 
 
29
-        default:               /* Parent */
 
30
-            crm_err("%s: Forked child %d to record non-fatal assert at %s:%d : %s",
 
31
-                    function, pid, file, line, assert_condition);
 
32
-            crm_write_blackbox(SIGTRAP, NULL);
 
33
+    /* Parent process */
 
34
+    crm_err("%s: Forked child %d to record non-fatal assert at %s:%d : %s",
 
35
+            function, pid, file, line, assert_condition);
 
36
+    crm_write_blackbox(SIGTRAP, NULL);
 
37
 
 
38
-            do {
 
39
-                rc = waitpid(pid, &status, 0);
 
40
-                if (rc < 0 && errno != EINTR) {
 
41
-                    crm_perror(LOG_ERR, "%s: Cannot wait on forked child %d", function, pid);
 
42
-                }
 
43
+    do {
 
44
+        rc = waitpid(pid, &status, 0);
 
45
+        if(rc == pid) {
 
46
+            return; /* Job done */
 
47
+        }
 
48
 
 
49
-            } while (rc < 0 && errno == EINTR);
 
50
+    } while(errno == EINTR);
 
51
 
 
52
-            return;
 
53
+    if (errno == ECHILD) {
 
54
+        /* crm_mon does this */
 
55
+        crm_trace("Cannot wait on forked child %d - SIGCHLD is probably set to SIG_IGN", pid);
 
56
+        return;
 
57
     }
 
58
+    crm_perror(LOG_ERR, "Cannot wait on forked child %d", pid);
 
59
 }
 
60
 
 
61
 char *