diff mbox

Fix dlfcn/failtestmod.c warning

Message ID alpine.DEB.2.10.1411262111040.29828@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers Nov. 26, 2014, 9:11 p.m. UTC
This patch fixes a "set but not used" warning from
dlfcn/failtestmod.c.  A variable is used only to store the return
value from dlsym.  As I understand this test, the point is simply to
do a sequence of load / unload operations in a loop, and all that
matters here is that dlsym gets called and returns without crashing,
not what its return value is.  So this patch removes the assignment to
a variable.

Tested for x86_64.

2014-11-26  Joseph Myers  <joseph@codesourcery.com>

	* dlfcn/failtestmod.c (constr): Do not store result of dlsym in a
	variable.

Comments

Ondřej Bílka Nov. 27, 2014, 3:21 p.m. UTC | #1
On Wed, Nov 26, 2014 at 09:11:19PM +0000, Joseph Myers wrote:
> This patch fixes a "set but not used" warning from
> dlfcn/failtestmod.c.  A variable is used only to store the return
> value from dlsym.  As I understand this test, the point is simply to
> do a sequence of load / unload operations in a loop, and all that
> matters here is that dlsym gets called and returns without crashing,
> not what its return value is.  So this patch removes the assignment to
> a variable.
> 
> Tested for x86_64.
> 
looks ok.
diff mbox

Patch

diff --git a/dlfcn/failtestmod.c b/dlfcn/failtestmod.c
index a03f90b..64dadd5 100644
--- a/dlfcn/failtestmod.c
+++ b/dlfcn/failtestmod.c
@@ -8,7 +8,6 @@  __attribute__ ((__constructor__))
 constr (void)
 {
   void *handle;
-  void *m;
 
   /* Open the library.  */
   handle = dlopen (NULL, RTLD_NOW);
@@ -19,7 +18,7 @@  constr (void)
     }
 
   /* Get a symbol.  */
-  m = dlsym (handle, "main");
+  dlsym (handle, "main");
   puts ("called dlsym() to get main");
 
   dlclose (handle);