summaryrefslogtreecommitdiff
path: root/src/system/dlt-system-process-handling.c
diff options
context:
space:
mode:
authorSimon Brandner <simon.brandner@partner.bmw.de>2013-01-28 12:14:06 +0100
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2013-07-19 16:54:38 +0200
commite2943ff4cf2d7d2da4000e2ca35663a7c83675d7 (patch)
tree1a710a70a5190dacdb26c02da6cb570271f5d506 /src/system/dlt-system-process-handling.c
parent733a1111254882aec6ebc9c90bb690aaee3f2773 (diff)
downloadDLT-daemon-e2943ff4cf2d7d2da4000e2ca35663a7c83675d7.tar.gz
Semaphores and Pointer passing insteasd by value and otehr coverity issue fixes
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/system/dlt-system-process-handling.c')
-rw-r--r--src/system/dlt-system-process-handling.c10
1 files changed, 9 insertions, 1 deletions
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;
}