X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=support%2Fnfs%2Fcacheio.c;h=9bad8e61f827e814592f539d51fc2784547b939a;hb=3ef3dc8f1e87ba7a6eaa3c2a6965aff6c80ba414;hp=bdf5d849b1baa353d1939cc84b3a486d93354173;hpb=7b0e4faaf3169c69828d3f7769ed8ce9142e100b;p=nfs-utils.git diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c index bdf5d84..9bad8e6 100644 --- a/support/nfs/cacheio.c +++ b/support/nfs/cacheio.c @@ -148,6 +148,11 @@ void qword_printint(FILE *f, int num) fprintf(f, "%d ", num); } +void qword_printuint(FILE *f, unsigned int num) +{ + fprintf(f, "%u ", num); +} + int qword_eol(FILE *f) { int err; @@ -236,6 +241,20 @@ int qword_get_int(char **bpp, int *anint) return 0; } +int qword_get_uint(char **bpp, unsigned int *anint) +{ + char buf[50]; + char *ep; + unsigned int rv; + int len = qword_get(bpp, buf, 50); + if (len < 0) return -1; + if (len ==0) return -1; + rv = strtoul(buf, &ep, 0); + if (*ep) return -1; + *anint = rv; + return 0; +} + #define READLINE_BUFFER_INCREMENT 2048 int readline(int fd, char **buf, int *lenp) @@ -330,7 +349,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)); }