[PATCH] Write to /dev/null rather than /dev/zero

Ulf Hermann ulf.hermann@qt.io
Thu May 4 16:05:00 GMT 2017


/dev/zero is meant for reading zeroes. /dev/null is for writing into
nirvana.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
 tests/ChangeLog     | 4 ++++
 tests/elfshphehdr.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index b8de138..fef6f55 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,9 @@
 2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* elfshphehdr.c: For writing, use /dev/null rather than /dev/zero.
+
+2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* newfile.c: Close the file when we're done and unlink it afterwards.
 	* newscn.c: Likewise.
 	* update1.c: Likewise.
diff --git a/tests/elfshphehdr.c b/tests/elfshphehdr.c
index d1ab633..e0f0712 100644
--- a/tests/elfshphehdr.c
+++ b/tests/elfshphehdr.c
@@ -152,7 +152,7 @@ main (int argc __attribute__ ((unused)), char **argv __attribute ((unused)))
 {
   elf_version (EV_CURRENT);
 
-  int fd = fd = open("/dev/zero", O_WRONLY | O_BINARY);
+  int fd = fd = open("/dev/null", O_WRONLY | O_BINARY);
   check ("open", fd >= 0);
 
   Elf *elf;
-- 
2.1.4



More information about the Elfutils-devel mailing list