From: Sami Kerola Date: Sun, 22 Jun 2014 21:59:57 +0000 (+0100) Subject: logger: ensure program writes everything to syslog file descriptor X-Git-Tag: v2.26-rc1~576^2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=633493beaf40ee88cdfb9db62a04a60f2a56c066;p=thirdparty%2Futil-linux.git 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 --- 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")); } }