[PATCH ocserv] main: check return of daemon()

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

 



Signed-off-by: Jason Cooper <jason at lakedaemon.net>
---
This silences the only warning outside of all the libopts warnings.

 src/main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/main.c b/src/main.c
index f6beca7..1485f80 100644
--- a/src/main.c
+++ b/src/main.c
@@ -607,8 +607,12 @@ int main(int argc, char** argv)
 
 	memset(&ws, 0, sizeof(ws));
 	
-	if (config.foreground == 0)
-		daemon(0, 0);
+	if (config.foreground == 0) {
+		if (daemon(0, 0) == -1) {
+			fprintf(stderr, "daemon failed: %s\n", strerror(errno));
+			exit(1);
+		}
+	}
 
 	write_pid_file();
 
-- 
1.8.1.4




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux