summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFerenc Wagner <wferi@niif.hu>2009-09-05 18:41:59 +0200
committerH. Peter Anvin <hpa@zytor.com>2009-09-14 14:41:02 -0700
commit3f2bc9833d8b4642aac2866f7718c80d5c0b52be (patch)
tree8a092ea95356c71edb9472d536d712ceb48ad79f
parent44c98cf8b63a644ee07ac12a1ed3503875bb2b4d (diff)
downloadtftp-hpa-3f2bc9833d8b4642aac2866f7718c80d5c0b52be.tar.gz
Ensure that the log socket is available for the child
Just in case syslog has been restarted, bounce the log socket before the chroot. Signed-off-by: Ferenc Wagner <wferi@niif.hu> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--tftpd/tftpd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
index 72d3e5d..721ebd8 100644
--- a/tftpd/tftpd.c
+++ b/tftpd/tftpd.c
@@ -870,6 +870,15 @@ int main(int argc, char **argv)
/* Ignore SIGHUP */
set_signal(SIGHUP, SIG_IGN, 0);
+ /* Make sure the log socket is still connected. This has to be
+ done before the chroot, while /dev/log is still accessible.
+ When not running standalone, there is little chance that the
+ syslog daemon gets restarted by the time we get here. */
+ if (secure && standalone) {
+ closelog();
+ openlog(__progname, LOG_PID | LOG_NDELAY, LOG_DAEMON);
+ }
+
#ifdef HAVE_TCPWRAPPERS
/* Verify if this was a legal request for us. This has to be
done before the chroot, while /etc is still accessible. */