summaryrefslogtreecommitdiffstats
path: root/daemons/based/based_io.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:45:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:45:40 +0000
commit07d7f4cfa4b10de87a31b68191036ff446add675 (patch)
tree7162524d8aaf1aef62d2f4fa51f595ed113981ff /daemons/based/based_io.c
parentAdding upstream version 2.1.6. (diff)
downloadpacemaker-07d7f4cfa4b10de87a31b68191036ff446add675.tar.xz
pacemaker-07d7f4cfa4b10de87a31b68191036ff446add675.zip
Adding upstream version 2.1.7.upstream/2.1.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'daemons/based/based_io.c')
-rw-r--r--daemons/based/based_io.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/daemons/based/based_io.c b/daemons/based/based_io.c
index fc34f39..f252ac1 100644
--- a/daemons/based/based_io.c
+++ b/daemons/based/based_io.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2022 the Pacemaker project contributors
+ * Copyright 2004-2023 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
@@ -22,6 +22,9 @@
#include <sys/wait.h>
#include <sys/stat.h>
+#include <glib.h>
+#include <libxml/tree.h>
+
#include <crm/crm.h>
#include <crm/cib.h>
@@ -45,12 +48,15 @@ cib_rename(const char *old)
umask(S_IWGRP | S_IWOTH | S_IROTH);
new_fd = mkstemp(new);
- crm_err("Archiving unusable file %s as %s", old, new);
+
if ((new_fd < 0) || (rename(old, new) < 0)) {
- crm_perror(LOG_ERR, "Couldn't rename %s as %s", old, new);
- crm_err("Disabling disk writes and continuing");
+ crm_err("Couldn't archive unusable file %s (disabling disk writes and continuing)",
+ old);
cib_writes_enabled = FALSE;
+ } else {
+ crm_err("Archived unusable file %s as %s", old, new);
}
+
if (new_fd > 0) {
close(new_fd);
}
@@ -107,7 +113,7 @@ static int cib_archive_filter(const struct dirent * a)
if(stat(a_path, &s) != 0) {
rc = errno;
- crm_trace("%s - stat failed: %s (%d)", a->d_name, pcmk_strerror(rc), rc);
+ crm_trace("%s - stat failed: %s (%d)", a->d_name, pcmk_rc_str(rc), rc);
rc = 0;
} else if ((s.st_mode & S_IFREG) != S_IFREG) {
@@ -189,7 +195,7 @@ readCibXmlFile(const char *dir, const char *file, gboolean discard_status)
const char *name = NULL;
const char *value = NULL;
const char *validation = NULL;
- const char *use_valgrind = getenv("PCMK_valgrind_enabled");
+ const char *use_valgrind = pcmk__env_option(PCMK__ENV_VALGRIND_ENABLED);
xmlNode *root = NULL;
xmlNode *status = NULL;
@@ -214,7 +220,7 @@ readCibXmlFile(const char *dir, const char *file, gboolean discard_status)
crm_warn("Primary configuration corrupt or unusable, trying backups in %s", cib_root);
lpc = scandir(cib_root, &namelist, cib_archive_filter, cib_archive_sort);
if (lpc < 0) {
- crm_perror(LOG_NOTICE, "scandir(%s) failed", cib_root);
+ crm_err("scandir(%s) failed: %s", cib_root, pcmk_rc_str(errno));
}
}
@@ -418,7 +424,7 @@ write_cib_contents(gpointer p)
pid = fork();
if (pid < 0) {
- crm_perror(LOG_ERR, "Disabling disk writes after fork failure");
+ crm_err("Disabling disk writes after fork failure: %s", pcmk_rc_str(errno));
cib_writes_enabled = FALSE;
return FALSE;
}