]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - support/nfs/cacheio.c
mountd: fix checking for errors when exporting filesystems
[nfs-utils.git] / support / nfs / cacheio.c
index 55fa45d7e620c458917d0015c3af19fbf39bc452..61e07a8257c961a7815ac0ae3816352cf14cfba5 100644 (file)
@@ -153,15 +153,25 @@ void qword_printuint(FILE *f, unsigned int num)
        fprintf(f, "%u ", num);
 }
 
+void qword_printtimefrom(FILE *f, unsigned int num)
+{
+       fprintf(f, "%lu ", time(0) + num);
+}
+
 int qword_eol(FILE *f)
 {
        int err;
 
-       fprintf(f,"\n");
-       err = fflush(f);
-       if (err) {
-               xlog_warn("qword_eol: fflush failed: errno %d (%s)",
+       err = fprintf(f,"\n");
+       if (err < 0) {
+               xlog_warn("qword_eol: fprintf failed: errno %d (%s)",
                            errno, strerror(errno));
+       } else {
+               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
@@ -349,7 +359,7 @@ cache_flush(int force)
                sprintf(path, "/proc/net/rpc/%s/flush", cachelist[c]);
                fd = open(path, O_RDWR);
                if (fd >= 0) {
-                       if (write(fd, stime, strlen(stime)) != strlen(stime)) {
+                       if (write(fd, stime, strlen(stime)) != (ssize_t)strlen(stime)) {
                                xlog_warn("Writing to '%s' failed: errno %d (%s)",
                                path, errno, strerror(errno));
                        }