summaryrefslogtreecommitdiffstats
path: root/ldpd/ldpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldpd/ldpd.c')
-rw-r--r--ldpd/ldpd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c
index 95cd4ba36..a79e63229 100644
--- a/ldpd/ldpd.c
+++ b/ldpd/ldpd.c
@@ -435,7 +435,7 @@ static pid_t
start_child(enum ldpd_process p, char *argv0, int fd_async, int fd_sync)
{
char *argv[3];
- int argc = 0;
+ int argc = 0, nullfd;
pid_t pid;
switch (pid = fork()) {
@@ -449,6 +449,12 @@ start_child(enum ldpd_process p, char *argv0, int fd_async, int fd_sync)
return (pid);
}
+ nullfd = open("/dev/null", O_RDONLY | O_NOCTTY);
+ dup2(nullfd, 0);
+ dup2(nullfd, 1);
+ dup2(nullfd, 2);
+ close(nullfd);
+
if (dup2(fd_async, LDPD_FD_ASYNC) == -1)
fatal("cannot setup imsg async fd");
if (dup2(fd_sync, LDPD_FD_SYNC) == -1)