rpms/elfutils/devel elfutils-0.125-warn_unused_result.patch, NONE, 1.1 elfutils.spec, 1.78, 1.79

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Jan 11 05:12:57 UTC 2007


Author: roland

Update of /cvs/dist/rpms/elfutils/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv2167

Modified Files:
	elfutils.spec 
Added Files:
	elfutils-0.125-warn_unused_result.patch 
Log Message:
Fix overeager warn_unused_result build failures.

elfutils-0.125-warn_unused_result.patch:
 0 files changed

--- NEW FILE elfutils-0.125-warn_unused_result.patch ---
# 
# 
# patch "libdwfl/ChangeLog"
#  from [544a978ac9415cf07af04b56c8cd6d02cb2f08b8]
#    to [27787e72a9e72720da7ff221ea4e379be2692bd9]
# 
# patch "libdwfl/find-debuginfo.c"
#  from [54d115ec2bad8682f03ae8c881a5af626c17b885]
#    to [18a70eb75a8694cc379541c0a911d4740c2ec171]
# 
# patch "libdwfl/linux-kernel-modules.c"
#  from [56948fc9d0a7f74e1c87b0a2db789e6298b43120]
#    to [17a0c60e241f083138511f715038799013766af5]
# 
============================================================
--- libdwfl/ChangeLog	544a978ac9415cf07af04b56c8cd6d02cb2f08b8
+++ libdwfl/ChangeLog	27787e72a9e72720da7ff221ea4e379be2692bd9
@@ -1,5 +1,12 @@ 2007-01-10  Roland McGrath  <roland at redh
 2007-01-10  Roland McGrath  <roland at redhat.com>
 
+	* linux-kernel-modules.c (report_kernel): Check asprintf return value
+	directly instead of via side effect, to silence warn_unused_result.
+	(dwfl_linux_kernel_report_offline): Likewise.
+	(dwfl_linux_kernel_find_elf): Likewise.
+	(dwfl_linux_kernel_module_section_address): Likewise.
+	* find-debuginfo.c (try_open): Likewise.
+
 	* libdwfl.h (dwfl_begin): Require nonnull argument.
 
 2006-12-27  Roland McGrath  <roland at redhat.com>
============================================================
--- libdwfl/find-debuginfo.c	54d115ec2bad8682f03ae8c881a5af626c17b885
+++ libdwfl/find-debuginfo.c	18a70eb75a8694cc379541c0a911d4740c2ec171
@@ -1,5 +1,5 @@
 /* Standard find_debuginfo callback for libdwfl.
-   Copyright (C) 2005, 2006 Red Hat, Inc.
+   Copyright (C) 2005, 2006, 2007 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -60,17 +60,16 @@ try_open (const char *dir, const char *s
 try_open (const char *dir, const char *subdir, const char *debuglink,
 	  char **debuginfo_file_name)
 {
-  char *fname = NULL;
+  char *fname;
   if (dir == NULL && subdir == NULL)
-    fname = strdup (debuglink);
-  else if (subdir == NULL)
-    asprintf (&fname, "%s/%s", dir, debuglink);
-  else if (dir == NULL)
-    asprintf (&fname, "%s/%s", subdir, debuglink);
-  else
-    asprintf (&fname, "%s/%s/%s", dir, subdir, debuglink);
-
-  if (fname == NULL)
+    {
+      fname = strdup (debuglink);
+      if (fname == NULL)
+	return -1;
+    }
+  else if ((subdir == NULL ? asprintf (&fname, "%s/%s", dir, debuglink)
+	    : dir == NULL ? asprintf (&fname, "%s/%s", subdir, debuglink)
+	    : asprintf (&fname, "%s/%s/%s", dir, subdir, debuglink)) < 0)
     return -1;
 
   int fd = TEMP_FAILURE_RETRY (open64 (fname, O_RDONLY));
============================================================
--- libdwfl/linux-kernel-modules.c	56948fc9d0a7f74e1c87b0a2db789e6298b43120
+++ libdwfl/linux-kernel-modules.c	17a0c60e241f083138511f715038799013766af5
@@ -1,5 +1,5 @@
 /* Standard libdwfl callbacks for debugging the running Linux kernel.
-   Copyright (C) 2005, 2006 Red Hat, Inc.
+   Copyright (C) 2005, 2006, 2007 Red Hat, Inc.
    This file is part of Red Hat elfutils.
 
    Red Hat elfutils is free software; you can redistribute it and/or modify
@@ -122,17 +122,17 @@ report_kernel (Dwfl *dwfl, const char *r
   if (dwfl == NULL)
     return -1;
 
-  char *fname = NULL;
-  if (release[0] == '/')
-    asprintf (&fname, "%s/vmlinux", release);
-  else
-    asprintf (&fname, "/boot/vmlinux-%s", release);
+  char *fname;
+  if ((release[0] == '/'
+       ? asprintf (&fname, "%s/vmlinux", release)
+       : asprintf (&fname, "/boot/vmlinux-%s", release)) < 0)
+    return -1;
   int fd = try_kernel_name (dwfl, &fname);
   if (fd < 0 && release[0] != '/')
     {
       free (fname);
-      fname = NULL;
-      asprintf (&fname, MODULEDIRFMT "/vmlinux", release);
+      if (asprintf (&fname, MODULEDIRFMT "/vmlinux", release) < 0)
+	return -1;
       fd = try_kernel_name (dwfl, &fname);
     }
 
@@ -195,8 +195,7 @@ dwfl_linux_kernel_report_offline (Dwfl *
 	modulesdir[0] = (char *) release;
       else
 	{
-	  asprintf (&modulesdir[0], MODULEDIRFMT "/kernel", release);
-	  if (modulesdir[0] == NULL)
+	  if (asprintf (&modulesdir[0], MODULEDIRFMT "/kernel", release) < 0)
 	    return errno;
 	}
 
@@ -310,8 +309,7 @@ dwfl_linux_kernel_find_elf (Dwfl_Module 
   /* Do "find /lib/modules/`uname -r`/kernel -name MODULE_NAME.ko".  */
 
   char *modulesdir[] = { NULL, NULL };
-  asprintf (&modulesdir[0], MODULEDIRFMT "/kernel", release);
-  if (modulesdir[0] == NULL)
+  if (asprintf (&modulesdir[0], MODULEDIRFMT "/kernel", release) < 0)
     return -1;
 
   FTS *fts = fts_open (modulesdir, FTS_LOGICAL | FTS_NOSTAT, NULL);
@@ -417,9 +415,8 @@ dwfl_linux_kernel_module_section_address
  const GElf_Shdr *shdr __attribute__ ((unused)),
  Dwarf_Addr *addr)
 {
-  char *sysfile = NULL;
-  asprintf (&sysfile, SECADDRDIRFMT "%s", modname, secname);
-  if (sysfile == NULL)
+  char *sysfile;
+  if (asprintf (&sysfile, SECADDRDIRFMT "%s", modname, secname))
     return ENOMEM;
 
   FILE *f = fopen (sysfile, "r");
@@ -453,9 +450,8 @@ dwfl_linux_kernel_module_section_address
 	  const bool is_init = !strncmp (secname, ".init", 5);
 	  if (is_init)
 	    {
-	      sysfile = NULL;
-	      asprintf (&sysfile, SECADDRDIRFMT "_%s", modname, &secname[1]);
-	      if (sysfile == NULL)
+	      if (asprintf (&sysfile, SECADDRDIRFMT "_%s",
+			    modname, &secname[1]) < 0)
 		return ENOMEM;
 	      f = fopen (sysfile, "r");
 	      free (sysfile);
@@ -469,10 +465,9 @@ dwfl_linux_kernel_module_section_address
 	  size_t namelen = strlen (secname);
 	  if (namelen >= MODULE_SECT_NAME_LEN)
 	    {
-	      sysfile = NULL;
 	      int len = asprintf (&sysfile, SECADDRDIRFMT "%s",
 				  modname, secname);
-	      if (sysfile == NULL)
+	      if (len < 0)
 		return ENOMEM;
 	      char *end = sysfile + len;
 	      do


Index: elfutils.spec
===================================================================
RCS file: /cvs/dist/rpms/elfutils/devel/elfutils.spec,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- elfutils.spec	11 Jan 2007 04:25:15 -0000	1.78
+++ elfutils.spec	11 Jan 2007 05:12:54 -0000	1.79
@@ -1,5 +1,5 @@
 %define eu_version 0.125
-%define eu_release 1
+%define eu_release 2
 
 %if %{?_with_compat:1}%{!?_with_compat:0}
 %define compat 1
@@ -35,6 +35,8 @@
 Source2: testfile16.symtab.bz2
 Source3: testfile16.symtab.debug.bz2
 
+Patch3: elfutils-0.125-warn_unused_result.patch
+
 # ExcludeArch: xxx
 
 BuildRoot: %{_tmppath}/%{name}-root
@@ -164,6 +166,7 @@
 %endif
 
 %patch2 -p1
+%patch3 -p0
 
 %build
 # Remove -Wall from default flags.  The makefiles enable enough warnings
@@ -271,6 +274,9 @@
 %{_libdir}/libelf.a
 
 %changelog
+* Wed Jan 10 2007 Roland McGrath <roland at redhat.com> - 0.125-2.fc7
+- Fix overeager warn_unused_result build failures.
+
 * Wed Jan 10 2007 Roland McGrath <roland at redhat.com> - 0.125-1
 - Update to 0.125
   - elflint: Compare DT_GNU_HASH tests.




More information about the fedora-cvs-commits mailing list