0a22bc
From 87257a49a1821d67870aa9760c71b6791583709c Mon Sep 17 00:00:00 2001
0a22bc
From: ikerexxe <ipedrosa@redhat.com>
0a22bc
Date: Fri, 2 Oct 2020 16:09:42 +0200
0a22bc
Subject: [PATCH] lib/sssd: redirect warning message to file
0a22bc
0a22bc
Instead of printing warning in stderr print it to file. This way the
0a22bc
user is not spammed with unnecessary messages when updating packages.
0a22bc
0a22bc
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1749001
0a22bc
---
0a22bc
 lib/sssd.c | 14 ++++++--------
0a22bc
 1 file changed, 6 insertions(+), 8 deletions(-)
0a22bc
0a22bc
diff --git a/lib/sssd.c b/lib/sssd.c
0a22bc
index 80e49e55..f864ce68 100644
0a22bc
--- a/lib/sssd.c
0a22bc
+++ b/lib/sssd.c
0a22bc
@@ -11,7 +11,7 @@
0a22bc
 #include "prototypes.h"
0a22bc
 #include "sssd.h"
0a22bc
 
0a22bc
-#define MSG_SSSD_FLUSH_CACHE_FAILED "%s: Failed to flush the sssd cache.\n"
0a22bc
+#define MSG_SSSD_FLUSH_CACHE_FAILED "%s: Failed to flush the sssd cache."
0a22bc
 
0a22bc
 int sssd_flush_cache (int dbflags)
0a22bc
 {
0a22bc
@@ -46,24 +46,22 @@ int sssd_flush_cache (int dbflags)
0a22bc
 	free(sss_cache_args);
0a22bc
 	if (rv != 0) {
0a22bc
 		/* run_command writes its own more detailed message. */
0a22bc
-		(void) fprintf (stderr, _(MSG_SSSD_FLUSH_CACHE_FAILED), Prog);
0a22bc
+		SYSLOG ((LOG_WARN, MSG_SSSD_FLUSH_CACHE_FAILED, Prog));
0a22bc
 		return -1;
0a22bc
 	}
0a22bc
 
0a22bc
 	code = WEXITSTATUS (status);
0a22bc
 	if (!WIFEXITED (status)) {
0a22bc
-		(void) fprintf (stderr,
0a22bc
-		                _("%s: sss_cache did not terminate normally (signal %d)\n"),
0a22bc
-		                Prog, WTERMSIG (status));
0a22bc
+		SYSLOG ((LOG_WARN, "%s: sss_cache did not terminate normally (signal %d)",
0a22bc
+			Prog, WTERMSIG (status)));
0a22bc
 		return -1;
0a22bc
 	} else if (code == E_CMD_NOTFOUND) {
0a22bc
 		/* sss_cache is not installed, or it is installed but uses an
0a22bc
 		   interpreter that is missing.  Probably the former. */
0a22bc
 		return 0;
0a22bc
 	} else if (code != 0) {
0a22bc
-		(void) fprintf (stderr, _("%s: sss_cache exited with status %d\n"),
0a22bc
-		                Prog, code);
0a22bc
-		(void) fprintf (stderr, _(MSG_SSSD_FLUSH_CACHE_FAILED), Prog);
0a22bc
+		SYSLOG ((LOG_WARN, "%s: sss_cache exited with status %d", Prog, code));
0a22bc
+		SYSLOG ((LOG_WARN, MSG_SSSD_FLUSH_CACHE_FAILED, Prog));
0a22bc
 		return -1;
0a22bc
 	}
0a22bc
 
0a22bc
-- 
0a22bc
2.26.2
0a22bc