]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
cacheio: return any original error from qword_eol nfs-utils-1-1-6-rc4
authorKevin Coffman <kwc@citi.umich.edu>
Fri, 3 Apr 2009 19:20:09 +0000 (15:20 -0400)
committerSteve Dickson <steved@redhat.com>
Fri, 3 Apr 2009 19:20:09 +0000 (15:20 -0400)
If the initial fflush() fails in qword_eol, log the failure
and return the indication of the original failure, not the
successful cover-up.

Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Signed-off-by: Steve Dickson <steved@redhat.com>
support/nfs/cacheio.c

index f30373402d0888009abd53f07f14da690c45f6dd..6a6ed5ac7f093a590e621895a03f2c9e3729683e 100644 (file)
@@ -154,15 +154,21 @@ int qword_eol(FILE *f)
 
        fprintf(f,"\n");
        err = fflush(f);
+       if (err) {
+               xlog_warn("qword_eol: fflush failed: errno %d (%s)",
+                           errno, strerror(errno));
+       }
        /*
         * We must send one line (and one line only) in a single write
         * call.  In case of a write error, libc may accumulate the
         * unwritten data and try to write it again later, resulting in a
         * multi-line write.  So we must explicitly ask it to throw away
-        * any such cached data:
+        * any such cached data.  But we return any original error
+        * indication to the caller.
         */
        __fpurge(f);
-       return fflush(f);
+       fflush(f);
+       return err;
 }