[sheepdog] [PATCH] sheep: mute gcc warning of uninitialized devnull_fd

Liu Yuan namei.unix at gmail.com
Thu May 2 07:40:46 CEST 2013


From: Liu Yuan <tailai.ly at taobao.com>

sheep.c:446:8: warning: ‘devnull_fd’ may be used uninitialized in this function [-Wuninitialized]
sheep.c:395:11: note: ‘devnull_fd’ was declared here

Just init devnull_fd to mute the warning.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/sheep.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sheep/sheep.c b/sheep/sheep.c
index bbfe772..1ae0c2a 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -392,7 +392,7 @@ static void check_host_env(void)
 
 static int lock_and_daemon(bool daemonize, const char *base_dir)
 {
-	int ret, devnull_fd;
+	int ret, devnull_fd = 0;
 
 	if (daemonize) {
 		switch (fork()) {
-- 
1.7.9.5




More information about the sheepdog mailing list