PATCH: silence libiberty warning

Ben Elliston bje@au1.ibm.com
Thu Jan 11 22:51:00 GMT 2007


On systems that declare various C library functions with attribute
warn_unused_result, libiberty produces the following warning:

libiberty/choose-temp.c:68: warning: ignoring return value of ‘mktemp’, declared with attribute warn_unused_result

The following patch fixes it.  Okay for the trunk?

2007-01-12  Ben Elliston  <bje@au.ibm.com>

        * choose-temp.c (choose_temp_base): Check the result of call to
        mktemp rather than testing the length of the modified string.

Index: choose-temp.c
===================================================================
RCS file: /cvs/src/src/libiberty/choose-temp.c,v
retrieving revision 1.10
diff -u -p -r1.10 choose-temp.c
--- choose-temp.c       24 May 2005 21:01:30 -0000      1.10
+++ choose-temp.c       11 Jan 2007 22:49:54 -0000
@@ -65,8 +65,7 @@ choose_temp_base (void)
   strcpy (temp_filename, base);
   strcpy (temp_filename + len, TEMP_FILE);
 
-  mktemp (temp_filename);
-  if (strlen (temp_filename) == 0)
+  if (mktemp (temp_filename) == 0)
     abort ();
   return temp_filename;
 }




More information about the Binutils mailing list