summaryrefslogtreecommitdiffstats
path: root/src/dfork.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dfork.c')
-rw-r--r--src/dfork.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/dfork.c b/src/dfork.c
index 41bd394..486a9fc 100644
--- a/src/dfork.c
+++ b/src/dfork.c
@@ -185,6 +185,11 @@ pid_t daemon_fork(void) {
setsid();
umask(0777);
chdir("/");
+
+ if ((tty_fd = open("/dev/tty", O_RDWR|O_NOCTTY)) >= 0) {
+ ioctl(tty_fd, TIOCNOTTY);
+ close(tty_fd);
+ }
if ((pid = fork()) < 0) { // Second fork
daemon_log(LOG_ERR, "Second fork() failed: %s", strerror(errno));