diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-01-30 15:38:04 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-01-30 15:38:04 -0800 |
commit | c7ecc59f86767b07498d770d4953b37fa205415d (patch) | |
tree | 2c007b42e38245169c775934d3eebf97fca25908 | |
parent | 077eac1fd62a6c9ca087278efb10cc6a6802d4bb (diff) | |
download | tftp-hpa-c7ecc59f86767b07498d770d4953b37fa205415d.tar.gz |
When running in secure mode (-s), we must not chdir while daemonizing
When running in secure mode (-s), we must not chdir while daemonizing.
Thanks to Adrian Urquhart for spotting this bug.
-rw-r--r-- | tftpd/tftpd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c index a1f30f6..92a6889 100644 --- a/tftpd/tftpd.c +++ b/tftpd/tftpd.c @@ -502,7 +502,9 @@ main(int argc, char **argv) } /* Daemonize this process */ - if (!nodaemon && daemon(0, 0) < 0) { + /* Note: when running in secure mode (-s), we must not chroot, since + we are already in the proper directory. */ + if (!nodaemon && daemon(secure, 0) < 0) { syslog(LOG_ERR, "cannot daemonize: %m"); exit(EX_OSERR); } |