From 5da772c28ffc2e798b079752876b950d1ce00260 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Sun, 22 Nov 2009 22:23:14 +0000 Subject: [PATCH] Make sure bootlogd fflush() every line, even if asked not to flush to disk using fdatasync(). Patch from Scott Gifford via Debian. --- doc/Changelog | 2 ++ src/bootlogd.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 9a9c63c..4a564e1 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -24,6 +24,8 @@ sysvinit (2.88dsf) UNRELEASED; urgency=low Patch from Debian. * Make sure bootlogd findpty() returns an error value when it fails to find a usable pty. Patch from Rob Leslie via Debian. + * Make sure bootlogd fflush() every line, even if asked not to flush + to disk using fdatasync(). Patch from Scott Gifford via Debian. -- Petter Reinholdtsen Sun, 12 Jul 2009 19:58:10 +0200 diff --git a/src/bootlogd.c b/src/bootlogd.c index e2eb4d8..6091e21 100644 --- a/src/bootlogd.c +++ b/src/bootlogd.c @@ -375,7 +375,7 @@ void writelog(FILE *fp, unsigned char *ptr, int len) break; case '\n': didnl = 1; - dosync = syncalot; + dosync = 1; break; case '\t': line.pos += (line.pos / 8 + 1) * 8; @@ -407,7 +407,9 @@ void writelog(FILE *fp, unsigned char *ptr, int len) if (dosync) { fflush(fp); - fdatasync(fileno(fp)); + if (syncalot) { + fdatasync(fileno(fp)); + } } outptr += olen;