ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
65878a
From d57b2e82e42d68555c92da2b19e07dbfdd74ab12 Mon Sep 17 00:00:00 2001
65878a
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
65878a
Date: Tue, 3 Dec 2013 08:07:32 -0500
65878a
Subject: [PATCH] journal: fail silently in sd_j_sendv() if journal is
65878a
 unavailable
65878a
65878a
"syslog(3) and sd_journal_print() may largely be used interchangeably
65878a
functionality-wise" according to sd_journal_print(3). This socket
65878a
should be always available except in rare circumstatances, and we
65878a
don't random applications to fail on logging, so let's do what syslog
65878a
did. The alternative of forcing all callers to do error handling for
65878a
this rare case doesn't really have any benefits, since if they can't
65878a
log there isn't much they can do anyway.
65878a
65878a
https://bugzilla.redhat.com/show_bug.cgi?id=1023041
65878a
---
65878a
 src/journal/journal-send.c | 4 ++++
65878a
 1 file changed, 4 insertions(+)
65878a
65878a
diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
65878a
index d00e26f..d99ff0c 100644
65878a
--- a/src/journal/journal-send.c
65878a
+++ b/src/journal/journal-send.c
65878a
@@ -305,6 +305,10 @@ _public_ int sd_journal_sendv(const struct iovec *iov, int n) {
65878a
         if (k >= 0)
65878a
                 return 0;
65878a
 
65878a
+        /* Fail silently if the journal is not available */
65878a
+        if (errno == ENOENT)
65878a
+                return 0;
65878a
+
65878a
         if (errno != EMSGSIZE && errno != ENOBUFS)
65878a
                 return -errno;
65878a