From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id CE2055A0059; Thu, 20 Jun 2024 18:15:18 +0200 (CEST) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH v5 9/9] log: Don't report syslog failures to stderr after initialisation Date: Thu, 20 Jun 2024 18:15:18 +0200 Message-ID: <20240620161518.142285-10-sbrivio@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240620161518.142285-1-sbrivio@redhat.com> References: <20240620161518.142285-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 67TBFWTQ4CBBMUPTGRETQLVETWYAW7V6 X-Message-ID-Hash: 67TBFWTQ4CBBMUPTGRETQLVETWYAW7V6 X-MailFrom: sbrivio@passt.top X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Yalan Zhang , David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: If we daemonised, we can't use standard error. If we didn't, it's rather annoying to have all those messages on standard error anyway, and kind of pointless too, as the messages we wanted to print were printed to standard error anyway. Signed-off-by: Stefano Brivio --- log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/log.c b/log.c index a72b871..9ed6bc1 100644 --- a/log.c +++ b/log.c @@ -191,7 +191,7 @@ void passt_vsyslog(int pri, const char *format, va_list ap) if (format[strlen(format)] != '\n') n += snprintf(buf + n, BUFSIZ - n, "\n"); - if (log_sock >= 0 && send(log_sock, buf, n, 0) != n) + if (log_sock >= 0 && send(log_sock, buf, n, 0) != n && !log_runtime) fprintf(stderr, "Failed to send %i bytes to syslog\n", n); } -- 2.43.0