This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Check result of "write"


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=83202f7ae849e538c04656923312d0eab32f6cea

commit 83202f7ae849e538c04656923312d0eab32f6cea
Author: Tom Tromey <tom@tromey.com>
Date:   Wed Aug 8 11:57:39 2018 -0600

    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".

Diff:
---
 gdb/ChangeLog                         | 4 ++++
 gdb/unittests/scoped_mmap-selftests.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b534e95..49a7e39 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/unittests/scoped_mmap-selftests.c b/gdb/unittests/scoped_mmap-selftests.c
index d70a56a..e9d4afd 100644
--- a/gdb/unittests/scoped_mmap-selftests.c
+++ b/gdb/unittests/scoped_mmap-selftests.c
@@ -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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]