From e2943ff4cf2d7d2da4000e2ca35663a7c83675d7 Mon Sep 17 00:00:00 2001 From: Simon Brandner Date: Mon, 28 Jan 2013 12:14:06 +0100 Subject: Semaphores and Pointer passing insteasd by value and otehr coverity issue fixes Signed-off-by: Alexander Wenzel --- src/system/dlt-system-process-handling.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/system/dlt-system-process-handling.c') diff --git a/src/system/dlt-system-process-handling.c b/src/system/dlt-system-process-handling.c index 3ad7908..49c20e7 100644 --- a/src/system/dlt-system-process-handling.c +++ b/src/system/dlt-system-process-handling.c @@ -81,9 +81,16 @@ int daemonize() close(i); int fd = open("/dev/null",O_RDWR); + if(fd < 0) + { + return -1; + } - if(fd < 0 || dup(fd) < 0 || dup(fd) < 0) + if(dup(fd) < 0 || dup(fd) < 0) + { + close(fd); return -1; + } /** * Ignore signals related to child processes and @@ -93,6 +100,7 @@ int daemonize() signal(SIGTSTP, SIG_IGN); signal(SIGTTOU, SIG_IGN); signal(SIGTTIN, SIG_IGN); + close(fd); return 0; } -- cgit v1.2.1