WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Fix "error: ignoring return value of ‘freopen’" comp

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Fix "error: ignoring return value of ‘freopen’" compile errors in xenwatchdogd
From: Patrick Colp <pjcolp@xxxxxxxxx>
Date: Fri, 4 Jun 2010 13:04:28 -0700
Delivery-date: Fri, 04 Jun 2010 13:05:40 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi,

While trying to compile the latest pull of xen-unstable, I ran into
these errors:

cc1: warnings being treated as errors
xenwatchdogd.c: In function ‘daemonize’:
xenwatchdogd.c:31: error: ignoring return value of ‘freopen’, declared
with attribute warn_unused_result
xenwatchdogd.c:32: error: ignoring return value of ‘freopen’, declared
with attribute warn_unused_result
xenwatchdogd.c:33: error: ignoring return value of ‘freopen’, declared
with attribute warn_unused_result
make: *** [xenwatchdogd.o] Error 1

This patch fixes xenwatchdogd to not ignore the return values.


Signed-off-by: Patrick Colp <pjcolp@xxxxxxxxx>

---

diff -r e9b5568232a8 tools/misc/xenwatchdogd.c
--- a/tools/misc/xenwatchdogd.c Fri Jun 04 10:46:14 2010 -0700
+++ b/tools/misc/xenwatchdogd.c Fri Jun 04 10:52:46 2010 -0700
@@ -28,9 +28,12 @@
        err(1, "setsid");
     if (chdir("/") < 0)
        err(1, "chdir /");
-    freopen("/dev/null", "r", stdin);
-    freopen("/dev/null", "w", stdout);
-    freopen("/dev/null", "w", stderr);
+    if (freopen("/dev/null", "r", stdin) == NULL)
+        err(1, "reopen stdin");
+    if(freopen("/dev/null", "w", stdout) == NULL)
+        err(1, "reopen stdout");
+    if(freopen("/dev/null", "w", stderr) == NULL)
+        err(1, "reopen stderr");
 }

 void catch_exit(int sig)

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fix "error: ignoring return value of ‘freopen’" compile errors in xenwatchdogd, Patrick Colp <=