File pacemaker-libcluster-libcrmcommon-improve-BZ2-error-messages.patch of Package pacemaker
commit 8ac666968562e167026bdb3e2dd31efcb09ed260
Author: Ken Gaillot <kgaillot@redhat.com>
Date: Mon Jan 8 14:00:51 2018 -0600
Log: libcluster,libcrmcommon: improve BZ2 error messages
Index: pacemaker-1.1.21+20190910.cd049beea/lib/cluster/cpg.c
===================================================================
--- pacemaker-1.1.21+20190910.cd049beea.orig/lib/cluster/cpg.c
+++ pacemaker-1.1.21+20190910.cd049beea/lib/cluster/cpg.c
@@ -325,7 +325,8 @@ pcmk_message_common_cs(cpg_handle_t hand
rc = BZ2_bzBuffToBuffDecompress(uncompressed, &new_size, msg->data, msg->compressed_size, 1, 0);
if (rc != BZ_OK) {
- crm_err("Decompression failed: %d", rc);
+ crm_err("Decompression failed: %s " CRM_XS " bzerror=%d",
+ bz2_strerror(rc), rc);
free(uncompressed);
goto badmsg;
}
Index: pacemaker-1.1.21+20190910.cd049beea/lib/common/ipc.c
===================================================================
--- pacemaker-1.1.21+20190910.cd049beea.orig/lib/common/ipc.c
+++ pacemaker-1.1.21+20190910.cd049beea/lib/common/ipc.c
@@ -530,7 +530,8 @@ crm_ipcs_recv(crm_client_t * c, void *da
text = uncompressed;
if (rc != BZ_OK) {
- crm_err("Decompression failed: %s (%d)", bz2_strerror(rc), rc);
+ crm_err("Decompression failed: %s " CRM_XS " bzerror=%d",
+ bz2_strerror(rc), rc);
free(uncompressed);
return NULL;
}
@@ -1107,7 +1108,8 @@ crm_ipc_decompress(crm_ipc_t * client)
client->buffer + hdr_offset, header->size_compressed, 1, 0);
if (rc != BZ_OK) {
- crm_err("Decompression failed: %s (%d)", bz2_strerror(rc), rc);
+ crm_err("Decompression failed: %s " CRM_XS " bzerror=%d",
+ bz2_strerror(rc), rc);
free(uncompressed);
return -EILSEQ;
}
Index: pacemaker-1.1.21+20190910.cd049beea/lib/common/remote.c
===================================================================
--- pacemaker-1.1.21+20190910.cd049beea.orig/lib/common/remote.c
+++ pacemaker-1.1.21+20190910.cd049beea/lib/common/remote.c
@@ -595,7 +595,8 @@ crm_remote_parse_buffer(crm_remote_t * r
return NULL;
} else if (rc != BZ_OK) {
- crm_err("Decompression failed: %s (%d)", bz2_strerror(rc), rc);
+ crm_err("Decompression failed: %s " CRM_XS " bzerror=%d",
+ bz2_strerror(rc), rc);
free(uncompressed);
return NULL;
}
Index: pacemaker-1.1.21+20190910.cd049beea/lib/common/strings.c
===================================================================
--- pacemaker-1.1.21+20190910.cd049beea.orig/lib/common/strings.c
+++ pacemaker-1.1.21+20190910.cd049beea/lib/common/strings.c
@@ -468,7 +468,8 @@ crm_compress_string(const char *data, in
free(uncompressed);
if (rc != BZ_OK) {
- crm_err("Compression of %d bytes failed: %s (%d)", length, bz2_strerror(rc), rc);
+ crm_err("Compression of %d bytes failed: %s " CRM_XS " bzerror=%d",
+ length, bz2_strerror(rc), rc);
free(compressed);
return FALSE;
}
Index: pacemaker-1.1.21+20190910.cd049beea/lib/common/xml.c
===================================================================
--- pacemaker-1.1.21+20190910.cd049beea.orig/lib/common/xml.c
+++ pacemaker-1.1.21+20190910.cd049beea/lib/common/xml.c
@@ -2264,8 +2264,9 @@ decompress_file(const char *filename)
}
bz_file = BZ2_bzReadOpen(&rc, input, 0, 0, NULL, 0);
-
if (rc != BZ_OK) {
+ crm_err("Could not prepare to read compressed %s: %s "
+ CRM_XS " bzerror=%d", filename, bz2_strerror(rc), rc);
BZ2_bzReadClose(&rc, bz_file);
return NULL;
}
@@ -2285,7 +2286,8 @@ decompress_file(const char *filename)
buffer[length] = '\0';
if (rc != BZ_STREAM_END) {
- crm_err("Couldn't read compressed xml from file");
+ crm_err("Could not read compressed %s: %s "
+ CRM_XS " bzerror=%d", filename, bz2_strerror(rc), rc);
free(buffer);
buffer = NULL;
}
@@ -2294,7 +2296,8 @@ decompress_file(const char *filename)
fclose(input);
#else
- crm_err("Cannot read compressed files:" " bzlib was not available at compile time");
+ crm_err("Could not read compressed %s: not built with bzlib support",
+ filename);
#endif
return buffer;
}
@@ -2486,21 +2489,23 @@ write_xml_stream(xmlNode * xml_node, con
bz_file = BZ2_bzWriteOpen(&rc, stream, 5, 0, 30);
if (rc != BZ_OK) {
- crm_warn("Not compressing %s: could not prepare file stream "
- CRM_XS " bzerror=%d", filename, rc);
+ crm_warn("Not compressing %s: could not prepare file stream: %s "
+ CRM_XS " bzerror=%d", filename, bz2_strerror(rc), rc);
} else {
BZ2_bzWrite(&rc, bz_file, buffer, strlen(buffer));
if (rc != BZ_OK) {
- crm_warn("Not compressing %s: could not compress data "
- CRM_XS " bzerror=%d errno=%d", filename, rc, errno);
+ crm_warn("Not compressing %s: could not compress data: %s "
+ CRM_XS " bzerror=%d errno=%d",
+ filename, bz2_strerror(rc), rc, errno);
}
}
if (rc == BZ_OK) {
BZ2_bzWriteClose(&rc, bz_file, 0, &in, &out);
if (rc != BZ_OK) {
- crm_warn("Not compressing %s: could not write compressed data "
- CRM_XS " bzerror=%d errno=%d", filename, rc, errno);
+ crm_warn("Not compressing %s: could not write compressed data: %s "
+ CRM_XS " bzerror=%d errno=%d",
+ filename, bz2_strerror(rc), rc, errno);
out = -1; // retry without compression
} else {
res = (int) out;