File pacemaker-libservices-stat-before-pipe.patch of Package pacemaker.3577

commit 5976fded9494bbb08e15c5ab6736f3bdfd8058ac
Author: NAKAHIRA Kazutomo <nakahira@intellilink.co.jp>
Date:   Thu Feb 18 15:23:32 2016 +0900

    Fix: libservices: Check resource agent is executable or not before pipe open.
    Currently, if lrmd execute resource operation and resource agent does not exist, then pipe does not closed.
    It waste 4 file descriptors each resource operation.

Index: pacemaker/lib/services/services_linux.c
===================================================================
--- pacemaker.orig/lib/services/services_linux.c
+++ pacemaker/lib/services/services_linux.c
@@ -600,14 +600,6 @@ services_os_action_execute(svc_action_t
     sigset_t old_mask;
     struct stat st;
 
-    if (pipe(stdout_fd) < 0) {
-        crm_err("pipe() failed");
-    }
-
-    if (pipe(stderr_fd) < 0) {
-        crm_err("pipe() failed");
-    }
-
     /* Fail fast */
     if(stat(op->opaque->exec, &st) != 0) {
         int rc = errno;
@@ -619,6 +611,14 @@ services_os_action_execute(svc_action_t
         return FALSE;
     }
 
+    if (pipe(stdout_fd) < 0) {
+        crm_err("pipe() failed");
+    }
+
+    if (pipe(stderr_fd) < 0) {
+        crm_err("pipe() failed");
+    }
+
     if (synchronous) {
         sigemptyset(&mask);
         sigaddset(&mask, SIGCHLD);
openSUSE Build Service is sponsored by