File pacemaker#3684-0001-High-libcrmcommon-Don-t-assert-on-failure-to-write-e.patch of Package pacemaker.36873

From 867c8d17ede64a59cde424e522a014caf50943aa Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Thu, 3 Oct 2024 09:56:10 -0400
Subject: [PATCH] High: libcrmcommon: Don't assert on failure to write errors.

Only text output mode is affected by this - other output formats write
to a buffer, so an error there is likely a memory problem and should be
asserted on.  vprintf/fprintf can return a negative value if the file
handle is closed (say, with shell output redirection) and we don't want
to assert on that.

Fixes T891
---
 lib/common/output_text.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

Index: pacemaker-2.0.5+20201202.ba59be712/lib/common/output_text.c
===================================================================
--- pacemaker-2.0.5+20201202.ba59be712.orig/lib/common/output_text.c
+++ pacemaker-2.0.5+20201202.ba59be712/lib/common/output_text.c
@@ -117,15 +117,13 @@ G_GNUC_PRINTF(2, 3)
 static void
 text_err(pcmk__output_t *out, const char *format, ...) {
     va_list ap;
-    int len = 0;
 
     va_start(ap, format);
 
     /* Informational output does not get indented, to separate it from other
      * potentially indented list output.
      */
-    len = vfprintf(stderr, format, ap);
-    CRM_ASSERT(len >= 0);
+    vfprintf(stderr, format, ap);
     va_end(ap);
 
     /* Add a newline. */
@@ -136,15 +134,13 @@ G_GNUC_PRINTF(2, 3)
 static void
 text_info(pcmk__output_t *out, const char *format, ...) {
     va_list ap;
-    int len = 0;
 
     va_start(ap, format);
 
     /* Informational output does not get indented, to separate it from other
      * potentially indented list output.
      */
-    len = vfprintf(out->dest, format, ap);
-    CRM_ASSERT(len >= 0);
+    vfprintf(out->dest, format, ap);
     va_end(ap);
 
     /* Add a newline. */
@@ -290,7 +286,6 @@ pcmk__mk_text_output(char **argv) {
 G_GNUC_PRINTF(2, 0)
 void
 pcmk__indented_vprintf(pcmk__output_t *out, const char *format, va_list args) {
-    int len = 0;
 
     if (fancy) {
         int level = 0;
@@ -309,8 +304,7 @@ pcmk__indented_vprintf(pcmk__output_t *o
         }
     }
 
-    len = vfprintf(out->dest, format, args);
-    CRM_ASSERT(len >= 0);
+    vfprintf(out->dest, format, args);
 }
 
 G_GNUC_PRINTF(2, 3)
openSUSE Build Service is sponsored by