[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] Fix "error: ignoring return value of âfreopenâ" compile errors in xenwatchdogd


  • To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Patrick Colp <pjcolp@xxxxxxxxx>
  • Date: Fri, 4 Jun 2010 13:04:28 -0700
  • Delivery-date: Fri, 04 Jun 2010 13:05:40 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.