[LEDE-DEV] [PATCH mountd 2/5] mountd: Fix unused result in main.c for daemon()

Florian Fainelli f.fainelli at gmail.com
Sun Mar 5 16:50:13 PST 2017


mountd-2016-12-19-dd5799c9/main.c: In function 'main':
mountd-2016-12-19-dd5799c9/main.c:18:9: error: ignoring return value of 'daemon', declared with attribute warn_unused_result [-Werror=unused-result]
   daemon(0,0);

Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c
index 815d58e33fd9..f8f051232719 100644
--- a/main.c
+++ b/main.c
@@ -14,8 +14,15 @@ int daemonize = 0;
 
 int main(int argc, char *argv[])
 {
+	int ret = 0;
+
 	if ((argc < 2) || strcmp(argv[1], "-f"))
-		daemon(0,0);
+		ret = daemon(0,0);
+
+	if (ret < 0) {
+		fprintf(stderr, "Failed to daemonize\n");
+		return 1;
+	}
 
 	daemonize = 1;
 	log_start();
-- 
2.9.3




More information about the Lede-dev mailing list