Attribute warn_unused_result

Robert Connolly robert at linuxfromscratch.org
Fri Aug 25 03:54:58 PDT 2006


In Make-3.81:

--- main.c.orig	2006-08-25 06:50:13.000000000 -0400
+++ main.c	2006-08-25 06:48:19.000000000 -0400
@@ -3065,8 +3065,10 @@
 	 puts core files in the original directory instead of the -C
 	 directory.  Must wait until after remove_intermediates(), or unlinks
          of relative pathnames fail.  */
-      if (directory_before_chdir != 0)
-	chdir (directory_before_chdir);
+      if (directory_before_chdir != 0) {
+	int rt = 0;
+	rt = chdir (directory_before_chdir);
+	}
 
       log_working_directory (0);
     }

This removes the warning, and 'make check' passes. I'm not entirely sure if 
this is the right though, maybe someone who knows C can comment.

robert

On Wednesday 23 August 2006 15:33, Filip Bartmann wrote:
> How can I disable(adjust source code)warnings about functions "declared
> with attribute warn_unused_result" in many HLFS packages, which is
> treated as errors with -Werror switch, which is in HLFS book used.
> This is with functions as:fgets,mktemp,fwrite_unlocked,fscanf,chdir...
> in packages as butterfly-toolchain,findutils,make...
> Filip Bartmann
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.linuxfromscratch.org/pipermail/hlfs-dev/attachments/20060825/2585d0db/attachment.sig>


More information about the hlfs-dev mailing list