naccyde / rpms / systemd

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