File pacemaker-libcrmcommon-use-tmp-when-creating-temporary-XML-file.patch of Package pacemaker.14737
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.
Index: pacemaker/lib/common/xml.c
===================================================================
--- pacemaker.orig/lib/common/xml.c
+++ pacemaker/lib/common/xml.c
@@ -5638,9 +5638,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);