Make sure bootlogd fflush() every line, even if asked not to flush
authorPetter Reinholdtsen <pere@hungry.com>
Sun, 22 Nov 2009 22:23:14 +0000 (22:23 +0000)
committerPetter Reinholdtsen <pere@hungry.com>
Sun, 22 Nov 2009 22:23:14 +0000 (22:23 +0000)
to disk using fdatasync().  Patch from Scott Gifford via Debian.

git-svn-id: svn://svn.sv.gnu.org/sysvinit/sysvinit/trunk@23 456724a4-4300-0410-8514-c89748c515a2

doc/Changelog
src/bootlogd.c

index 9a9c63caf762f8aef1e3976ff2c109e98085fd51..4a564e148df2083156358ee7c0a6bc8d99f82203 100644 (file)
@@ -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 <pere@hungry.com>  Sun, 12 Jul 2009 19:58:10 +0200
 
index e2eb4d8a68faf635e1f9e7329b8d290834a05928..6091e21b799329c23c9fb532e2af074d9c4d17b4 100644 (file)
@@ -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;