aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2019-12-10 18:59:06 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-12-10 18:59:06 +0100
commit101194ebf6834198300032f6fb438f2c4cdf0401 (patch)
tree81ebd590b8d14d2c312f1012214ae31679a4ea6c /executor
parentcb704a294c54aed90281c016a6dc0c40ae295601 (diff)
executor: check pwrite return values again
Build with some gcc's fails: In file included from executor/executor.cc:133:0: executor/common_linux.h: In function ‘long int syz_read_part_table(long unsigned int, long unsigned int, long int)’: executor/common.h:117:15: error: ignoring return value of ‘ssize_t pwrite(int, const void*, size_t, __off_t)’, declared with attribute warn_unused_result [-Werror=unused-result] __VA_ARGS__; \ ^ executor/common_linux.h:1279:3: note: in expansion of macro ‘NONFAILING’ NONFAILING(pwrite(memfd, segs[i].data, segs[i].size, segs[i].offset)); ^ executor/common_linux.h: In function ‘long int syz_mount_image(long int, long int, long unsigned int, long unsigned int, long int, long int, long int)’: executor/common.h:117:15: error: ignoring return value of ‘ssize_t pwrite(int, const void*, size_t, __off_t)’, declared with attribute warn_unused_result [-Werror=unused-result] __VA_ARGS__; \ ^ executor/common_linux.h:1364:3: note: in expansion of macro ‘NONFAILING’ NONFAILING(pwrite(memfd, segs[i].data, segs[i].size, segs[i].offset)); ^ cc1plus: all warnings being treated as errors
Diffstat (limited to 'executor')
-rw-r--r--executor/common_linux.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h
index 74ffa0847..4ad991fc4 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -1276,7 +1276,11 @@ static long syz_read_part_table(volatile unsigned long size, volatile unsigned l
}
for (i = 0; i < nsegs; i++) {
struct fs_image_segment* segs = (struct fs_image_segment*)segments;
- NONFAILING(pwrite(memfd, segs[i].data, segs[i].size, segs[i].offset));
+ int res1 = 0;
+ NONFAILING(res1 = pwrite(memfd, segs[i].data, segs[i].size, segs[i].offset));
+ if (res1 < 0) {
+ debug("syz_read_part_table: pwrite[%u] failed: %d\n", (int)i, errno);
+ }
}
snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid);
loopfd = open(loopname, O_RDWR);
@@ -1361,7 +1365,11 @@ static long syz_mount_image(volatile long fsarg, volatile long dir, volatile uns
}
for (i = 0; i < nsegs; i++) {
struct fs_image_segment* segs = (struct fs_image_segment*)segments;
- NONFAILING(pwrite(memfd, segs[i].data, segs[i].size, segs[i].offset));
+ int res1 = 0;
+ NONFAILING(res1 = pwrite(memfd, segs[i].data, segs[i].size, segs[i].offset));
+ if (res1 < 0) {
+ debug("syz_mount_image: pwrite[%u] failed: %d\n", (int)i, errno);
+ }
}
snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid);
loopfd = open(loopname, O_RDWR);