summaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2009-03-23 17:13:01 -0400
committerSteve Dickson <steved@redhat.com>2009-03-23 17:13:01 -0400
commit3724317e223d46908aac2405bbd73ea2de4f36e5 (patch)
tree4498459f0dd3f88349c5126792f3715200397eed /support
parentd62365079f711b25e73522b2af380abc2a7e2788 (diff)
downloadnfs-utils-3724317e223d46908aac2405bbd73ea2de4f36e5.tar.gz
nfs-utils-3724317e223d46908aac2405bbd73ea2de4f36e5.tar.xz
nfs-utils-3724317e223d46908aac2405bbd73ea2de4f36e5.zip
In recent Fedora builds, the '-D _FORTIFY_SOURCE=2' compile
flag has been set. This cause warnings to be generated when return values from reads/writes (and other calls) are not checked. The patch address those warnings. Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'support')
-rw-r--r--support/nfs/cacheio.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c
index 48292f8..f303734 100644
--- a/support/nfs/cacheio.c
+++ b/support/nfs/cacheio.c
@@ -24,6 +24,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
+#include <errno.h>
void qword_add(char **bpp, int *lp, char *str)
{
@@ -125,7 +126,10 @@ void qword_print(FILE *f, char *str)
char *bp = qword_buf;
int len = sizeof(qword_buf);
qword_add(&bp, &len, str);
- fwrite(qword_buf, bp-qword_buf, 1, f);
+ if (fwrite(qword_buf, bp-qword_buf, 1, f) != 1) {
+ xlog_warn("qword_print: fwrite failed: errno %d (%s)",
+ errno, strerror(errno));
+ }
}
void qword_printhex(FILE *f, char *str, int slen)
@@ -133,7 +137,10 @@ void qword_printhex(FILE *f, char *str, int slen)
char *bp = qword_buf;
int len = sizeof(qword_buf);
qword_addhex(&bp, &len, str, slen);
- fwrite(qword_buf, bp-qword_buf, 1, f);
+ if (fwrite(qword_buf, bp-qword_buf, 1, f) != 1) {
+ xlog_warn("qword_printhex: fwrite failed: errno %d (%s)",
+ errno, strerror(errno));
+ }
}
void qword_printint(FILE *f, int num)
@@ -318,7 +325,10 @@ cache_flush(int force)
sprintf(path, "/proc/net/rpc/%s/flush", cachelist[c]);
fd = open(path, O_RDWR);
if (fd >= 0) {
- write(fd, stime, strlen(stime));
+ if (write(fd, stime, strlen(stime)) != strlen(stime)) {
+ xlog_warn("Writing to '%s' failed: errno %d (%s)",
+ path, errno, strerror(errno));
+ }
close(fd);
}
}