Make sure bootlogd fflush() every line, even if asked not to flush

to disk using fdatasync().  Patch from Scott Gifford via Debian.
This commit is contained in:
Petter Reinholdtsen 2009-11-22 22:23:14 +00:00
parent 8debc401f8
commit 5da772c28f
2 changed files with 6 additions and 2 deletions

View File

@ -24,6 +24,8 @@ sysvinit (2.88dsf) UNRELEASED; urgency=low
Patch from Debian. Patch from Debian.
* Make sure bootlogd findpty() returns an error value when it fails to * Make sure bootlogd findpty() returns an error value when it fails to
find a usable pty. Patch from Rob Leslie via Debian. 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 <pere@hungry.com> Sun, 12 Jul 2009 19:58:10 +0200 -- Petter Reinholdtsen <pere@hungry.com> Sun, 12 Jul 2009 19:58:10 +0200

View File

@ -375,7 +375,7 @@ void writelog(FILE *fp, unsigned char *ptr, int len)
break; break;
case '\n': case '\n':
didnl = 1; didnl = 1;
dosync = syncalot; dosync = 1;
break; break;
case '\t': case '\t':
line.pos += (line.pos / 8 + 1) * 8; line.pos += (line.pos / 8 + 1) * 8;
@ -407,8 +407,10 @@ void writelog(FILE *fp, unsigned char *ptr, int len)
if (dosync) { if (dosync) {
fflush(fp); fflush(fp);
if (syncalot) {
fdatasync(fileno(fp)); fdatasync(fileno(fp));
} }
}
outptr += olen; outptr += olen;
if (outptr >= endptr) if (outptr >= endptr)