about summary refs log tree commit diff
path: root/dlfcn/bug-atexit3-lib.cc
diff options
context:
space:
mode:
authorGabriel F T Gomes <gftg@linux.vnet.ibm.com>2016-10-28 15:57:15 -0200
committerGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>2016-10-28 19:26:14 -0200
commit1b16ff0b1e6906d4f5a4380c4ca5750e87c5e52d (patch)
tree2768bb48cfa51692718f305da7bfd91998928ac0 /dlfcn/bug-atexit3-lib.cc
parentf82a4bdb73328bc53bdcc344622acbd96522a83c (diff)
downloadglibc-1b16ff0b1e6906d4f5a4380c4ca5750e87c5e52d.tar.gz
glibc-1b16ff0b1e6906d4f5a4380c4ca5750e87c5e52d.tar.xz
glibc-1b16ff0b1e6906d4f5a4380c4ca5750e87c5e52d.zip
Fix warning caused by unused-result in bug-atexit3-lib.cc
The test case dlfcn/bug-atexit3-lib.cc calls write and doesn't check the
result.  When building with GCC 6.2, this generates a warning in 'make
check', which is treated as an error.  This patch replaces the call to
write with a call to write_message.

Tested for powerpc64le.
Diffstat (limited to 'dlfcn/bug-atexit3-lib.cc')
-rw-r--r--dlfcn/bug-atexit3-lib.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/dlfcn/bug-atexit3-lib.cc b/dlfcn/bug-atexit3-lib.cc
index 3d01ea81d2..aba772004d 100644
--- a/dlfcn/bug-atexit3-lib.cc
+++ b/dlfcn/bug-atexit3-lib.cc
@@ -1,14 +1,22 @@
 #include <unistd.h>
+#include <string.h>
+
+static void
+write_message (const char *message)
+{
+  ssize_t unused __attribute__ ((unused));
+  unused = write (STDOUT_FILENO, message, strlen (message));
+}
 
 struct statclass
 {
   statclass()
   {
-    write (1, "statclass\n", 10);
+    write_message ("statclass\n");
   }
   ~statclass()
   {
-    write (1, "~statclass\n", 11);
+    write_message ("~statclass\n");
   }
 };