summaryrefslogtreecommitdiffstats
path: root/misc-utils
diff options
context:
space:
mode:
authorSami Kerola2014-06-22 23:59:57 +0200
committerSami Kerola2014-07-28 22:15:16 +0200
commit633493beaf40ee88cdfb9db62a04a60f2a56c066 (patch)
tree4fdf37c871cff94985ccd5f0d3196347d27f840c /misc-utils
parentagetty: Reprompt and reprint /etc/issue when asked (diff)
downloadkernel-qcow2-util-linux-633493beaf40ee88cdfb9db62a04a60f2a56c066.tar.gz
kernel-qcow2-util-linux-633493beaf40ee88cdfb9db62a04a60f2a56c066.tar.xz
kernel-qcow2-util-linux-633493beaf40ee88cdfb9db62a04a60f2a56c066.zip
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 <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/logger.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/misc-utils/logger.c b/misc-utils/logger.c
index 0bf5e536a..37d632edf 100644
--- a/misc-utils/logger.c
+++ b/misc-utils/logger.c
@@ -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"));
}
}