]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
logger: ensure program writes everything to syslog file descriptor
authorSami Kerola <kerolasa@iki.fi>
Sun, 22 Jun 2014 21:59:57 +0000 (22:59 +0100)
committerSami Kerola <kerolasa@iki.fi>
Mon, 28 Jul 2014 20:15:16 +0000 (21:15 +0100)
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 <kerolasa@iki.fi>
misc-utils/logger.c

index 0bf5e536a49c0e8c0fa89b8ff80393b1a576fe0d..37d632edfb4ed390bb8b5a5a1fa0e221dc74745f 100644 (file)
@@ -51,6 +51,7 @@
 #include <netdb.h>
 #include <getopt.h>
 
+#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"));
        }
 }