diff options
Diffstat (limited to 'accel-pppd/logs')
-rw-r--r-- | accel-pppd/logs/log_file.c | 4 | ||||
-rw-r--r-- | accel-pppd/logs/log_tcp.c | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/accel-pppd/logs/log_file.c b/accel-pppd/logs/log_file.c index f1a50185..48f43510 100644 --- a/accel-pppd/logs/log_file.c +++ b/accel-pppd/logs/log_file.c @@ -106,6 +106,8 @@ static int log_file_open(struct log_file_t *lf, const char *fname) return -1; } + fcntl(lf->fd, F_SETFD, fcntl(lf->fd, F_GETFD) | FD_CLOEXEC); + lf->offset = lseek(lf->fd, 0, SEEK_END); return 0; @@ -412,6 +414,7 @@ static void fail_reopen(void) log_emerg("log_file: open '%s': %s\n", fname, strerror(errno)); return; } + fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); fail_log_file->new_fd = fd; } @@ -424,6 +427,7 @@ static void general_reopen(void) log_emerg("log_file: open '%s': %s\n", fname, strerror(errno)); return; } + fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC); log_file->new_fd = fd; } diff --git a/accel-pppd/logs/log_tcp.c b/accel-pppd/logs/log_tcp.c index ceaeb1c0..3f76ff8a 100644 --- a/accel-pppd/logs/log_tcp.c +++ b/accel-pppd/logs/log_tcp.c @@ -210,6 +210,8 @@ static void start_connect(struct tcp_target_t *t) return; } + fcntl(t->hnd.fd, F_SETFD, fcntl(t->hnd.fd, F_GETFD) | FD_CLOEXEC); + if (fcntl(t->hnd.fd, F_SETFL, O_NONBLOCK)) { log_emerg("log-tcp: failed to set nonblocking mode: %s\n", strerror(errno)); close(t->hnd.fd); |