X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=support%2Fnfs%2Fcacheio.c;h=61e07a8257c961a7815ac0ae3816352cf14cfba5;hb=188e5ae9789bf0a7f8033f6aae40e65e652c7b08;hp=0587ecbecefff75636e81637a56e45046adb5af6;hpb=6ca440c2661dccb05ae74ffb65817e9c30f05c8a;p=nfs-utils.git diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c index 0587ecb..61e07a8 100644 --- a/support/nfs/cacheio.c +++ b/support/nfs/cacheio.c @@ -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 @@ -241,7 +251,7 @@ int qword_get_int(char **bpp, int *anint) return 0; } -int qword_get_uint(char *bpp, unsigned int *anint) +int qword_get_uint(char **bpp, unsigned int *anint) { char buf[50]; char *ep; @@ -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)); }