From 633493beaf40ee88cdfb9db62a04a60f2a56c066 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sun, 22 Jun 2014 22:59:57 +0100 Subject: [PATCH] logger: ensure program writes everything to syslog file descriptor It is fair assumption messages an user is asking to be wrote will be attempted to be wrote as hard as possible. Signed-off-by: Sami Kerola --- misc-utils/logger.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/misc-utils/logger.c b/misc-utils/logger.c index 0bf5e536a4..37d632edfb 100644 --- a/misc-utils/logger.c +++ b/misc-utils/logger.c @@ -51,6 +51,7 @@ #include #include +#include "all-io.h" #include "c.h" #include "closestream.h" #include "nls.h" @@ -281,8 +282,8 @@ static void mysyslog(int fd, int logflags, int pri, char *tag, char *msg) snprintf(buf, sizeof(buf), "<%d>%.15s %.200s%s: %.400s", pri, tp, cp, pid, msg); - if (write(fd, buf, strlen(buf)+1) < 0) - return; /* error */ + if (write_all(fd, buf, strlen(buf)+1) < 0) + warn(_("write failed")); } } -- 2.47.3