summaryrefslogtreecommitdiffstats
path: root/vespalog
diff options
context:
space:
mode:
authorArne H. Juul <arnej@pvv.ntnu.no>2016-06-24 13:17:12 +0200
committerArne H. Juul <arnej@pvv.ntnu.no>2016-07-02 14:47:30 +0200
commitbb94e3b36cce9d88ad24927445a372db03ef2b36 (patch)
treea2b7c9cc016a331ff338a06b2050ab083b996900 /vespalog
parent7d6f65499de1db475df68d53ecda67160635ab35 (diff)
avoid "unused result" warnings
Diffstat (limited to 'vespalog')
-rw-r--r--vespalog/src/vespa/log/control-file.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/vespalog/src/vespa/log/control-file.cpp b/vespalog/src/vespa/log/control-file.cpp
index 3b9fe2834a9..32f5a850ccd 100644
--- a/vespalog/src/vespa/log/control-file.cpp
+++ b/vespalog/src/vespa/log/control-file.cpp
@@ -58,10 +58,15 @@ ControlFile::ensureHeader()
int len = read(fd, &buf, wantsLen);
if (len != wantsLen || memcmp(fileHeader, buf, wantsLen) != 0) {
if (len) {
- ftruncate(fd, 0);
+ if (ftruncate(fd, 0) != 0) {
+ perror("log::ControlFile ftruncate failed");
+ }
}
lseek(fd, 0, SEEK_SET);
- write(fd, fileHeader, strlen(fileHeader));
+ ssize_t nbw = write(fd, fileHeader, wantsLen);
+ if (nbw != wantsLen) {
+ perror("log::ControlFile write(A) failed");
+ }
char spaces[_maxPrefix + 1];
memset(spaces, ' ', sizeof spaces);
@@ -69,7 +74,12 @@ ControlFile::ensureHeader()
char buf2[sizeof(spaces) + 100];
snprintf(buf2, sizeof buf2, "Prefix: \n%s\n", spaces);
- write(fd, buf2, strlen(buf2));
+ wantsLen = strlen(buf2);
+ nbw = write(fd, buf2, wantsLen);
+ if (nbw != wantsLen) {
+ perror("log::ControlFile write(B) failed");
+ }
+
}
}