 
	
| [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
 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
 | 
|  | Lists.xenproject.org is hosted with RackSpace, monitoring our |