summaryrefslogtreecommitdiffstats
path: root/tests/tcg/test-mmap.c
diff options
context:
space:
mode:
authorCatalin Patulea <catalinp@google.com>2012-10-29 14:01:07 -0400
committerBlue Swirl <blauwirbel@gmail.com>2012-10-30 18:55:02 +0000
commitf71d61216ea8eb914ee79459a58dc5343d95ddec (patch)
treec98ed8eedba172e87fcabcaae6c9d275d85cfe54 /tests/tcg/test-mmap.c
parenta1d29d6c1d4002a5c7b19eda61d794f4c22538dd (diff)
downloadhqemu-f71d61216ea8eb914ee79459a58dc5343d95ddec.zip
hqemu-f71d61216ea8eb914ee79459a58dc5343d95ddec.tar.gz
tests/tcg: fix unused result warnings
With i386-linux-user target on x86_64 host, this does not introduce any new test failures. Signed-off-by: Catalin Patulea <catalinp@google.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'tests/tcg/test-mmap.c')
-rw-r--r--tests/tcg/test-mmap.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/tcg/test-mmap.c b/tests/tcg/test-mmap.c
index c418b67..3982fa2 100644
--- a/tests/tcg/test-mmap.c
+++ b/tests/tcg/test-mmap.c
@@ -429,6 +429,12 @@ void check_file_fixed_mmaps(void)
fprintf (stderr, " passed\n");
}
+void checked_write(int fd, const void *buf, size_t count)
+{
+ ssize_t rc = write(fd, buf, count);
+ fail_unless(rc == count);
+}
+
int main(int argc, char **argv)
{
char tempname[] = "/tmp/.cmmapXXXXXX";
@@ -450,13 +456,15 @@ int main(int argc, char **argv)
unlink(tempname);
/* Fill the file with int's counting from zero and up. */
- for (i = 0; i < (pagesize * 4) / sizeof i; i++)
- write (test_fd, &i, sizeof i);
+ for (i = 0; i < (pagesize * 4) / sizeof i; i++) {
+ checked_write(test_fd, &i, sizeof i);
+ }
+
/* Append a few extra writes to make the file end at non
page boundary. */
- write (test_fd, &i, sizeof i); i++;
- write (test_fd, &i, sizeof i); i++;
- write (test_fd, &i, sizeof i); i++;
+ checked_write(test_fd, &i, sizeof i); i++;
+ checked_write(test_fd, &i, sizeof i); i++;
+ checked_write(test_fd, &i, sizeof i); i++;
test_fsize = lseek(test_fd, 0, SEEK_CUR);
OpenPOWER on IntegriCloud