File pacemaker-libcrmcommon-use-tmp-when-creating-temporary-XML-file.patch of Package pacemaker

commit e1bcd6066e9892dfeea889e741a11044d97f2497
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Tue Feb 13 17:21:37 2018 -0600

    Low: libcrmcommon: use /tmp when creating temporary XML file
    
    ... instead of CRM_STATE_DIR, which may not be usable from an ordinary user's
    account, thus generating incorrect CLI regression test output when run from a
    checkout.

diff --git a/lib/common/schemas.c b/lib/common/schemas.c
index 6bfef4e86..b4a0437f0 100644
--- a/lib/common/schemas.c
+++ b/lib/common/schemas.c
@@ -560,9 +560,13 @@ validate_xml_verbose(xmlNode *xml_blob)
     xmlDoc *doc = NULL;
     xmlNode *xml = NULL;
     gboolean rc = FALSE;
-    char *filename = strdup(CRM_STATE_DIR "/cib-invalid.XXXXXX");
+    const char *tmpdir = getenv("TMPDIR");
+    char *filename = NULL;
 
-    CRM_CHECK(filename != NULL, return FALSE);
+    if ((tmpdir == NULL) || (*tmpdir != '/')) {
+        tmpdir = "/tmp";
+    }
+    filename = crm_strdup_printf("%s/cib-invalid.XXXXXX", tmpdir);
 
     umask(S_IWGRP | S_IWOTH | S_IROTH);
     fd = mkstemp(filename);