alexk / rpms / rpm

Forked from rpms/rpm 2 years ago
Clone
648606
From f515907c71c03019a52f89921c41303fa5926b2a Mon Sep 17 00:00:00 2001
648606
From: Lubos Kardos <lkardos@redhat.com>
648606
Date: Fri, 12 Jun 2015 13:38:23 +0200
648606
Subject: [PATCH] Don't show error message if log function fails because of
648606
 broken pipe.
648606
648606
- regression from commit 11b005c957fb0e52d42078480104d3e27e95e609
648606
- rhbz: #1231138
648606
---
648606
 rpmio/rpmlog.c | 7 ++++---
648606
 1 file changed, 4 insertions(+), 3 deletions(-)
648606
648606
diff --git a/rpmio/rpmlog.c b/rpmio/rpmlog.c
648606
index f43e622..43ae36f 100644
648606
--- a/rpmio/rpmlog.c
648606
+++ b/rpmio/rpmlog.c
648606
@@ -4,7 +4,8 @@
648606
 
648606
 #include "system.h"
648606
 #include <stdarg.h>
648606
+#include <errno.h>
648606
 #include <stdlib.h>
648606
 #include <rpm/rpmlog.h>
648606
 #include "debug.h"
648606
 
648606
@@ -127,13 +128,13 @@ static int rpmlogDefault(FILE *stdlog, rpmlogRec rec)
648606
         break;
648606
     }
648606
 
648606
-    if (fputs(rpmlogLevelPrefix(rec->pri), msgout) == EOF)
648606
+    if (fputs(rpmlogLevelPrefix(rec->pri), msgout) == EOF && errno != EPIPE)
648606
 	perror("Error occurred during writing of a log message");
648606
 
648606
-    if (fputs(rec->message, msgout) == EOF)
648606
+    if (fputs(rec->message, msgout) == EOF && errno != EPIPE)
648606
 	perror("Error occurred during writing of a log message");
648606
 
648606
-    if (fflush(msgout) == EOF)
648606
+    if (fflush(msgout) == EOF && errno != EPIPE)
648606
 	perror("Error occurred during writing of a log message");
648606
 
648606
     return (rec->pri <= RPMLOG_CRIT ? RPMLOG_EXIT : 0);
648606
-- 
648606
1.9.3
648606