]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - support/nfs/cacheio.c
Use authunix_create() instead of authsys_create() to fix regression.
[nfs-utils.git] / support / nfs / cacheio.c
index f30373402d0888009abd53f07f14da690c45f6dd..bdf5d849b1baa353d1939cc84b3a486d93354173 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;
 }
 
 
@@ -279,9 +285,8 @@ int readline(int fd, char **buf, int *lenp)
 int
 check_new_cache(void)
 {
-       struct stat stb;
-       return  (stat("/proc/fs/nfs/filehandle", &stb) == 0) ||
-               (stat("/proc/fs/nfsd/filehandle", &stb) == 0);
+       return  (access("/proc/fs/nfs/filehandle", F_OK) == 0) ||
+               (access("/proc/fs/nfsd/filehandle", F_OK) == 0);
 }