Check result of "write"

Some distros enable _FORTIFY_SOURCE by default, which caught a failure
to check the result of "write" in scoped_mmap-selftests.c.  This patch
fixes the problem.

ChangeLog
2018-08-08  Tom Tromey  <tom@tromey.com>

	* unittests/scoped_mmap-selftests.c: Check result of "write".
This commit is contained in:
Tom Tromey 2018-08-08 11:57:39 -06:00
parent 5c720ed886
commit 83202f7ae8
2 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2018-08-08 Tom Tromey <tom@tromey.com>
* unittests/scoped_mmap-selftests.c: Check result of "write".
2018-08-08 Jim Wilson <jimw@sifive.com>
* riscv-tdep.c (enum opcode): Add jump, branch, lr, and sc opcodes.

View File

@ -91,7 +91,7 @@ test_normal ()
int fd = mkstemp (filename);
SELF_CHECK (fd >= 0);
write (fd, "Hello!", 7);
SELF_CHECK (write (fd, "Hello!", 7) == 7);
close (fd);
gdb::unlinker unlink_test_file (filename);