aboutsummaryrefslogtreecommitdiff
path: root/networking/tftp.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-04-11 05:12:53 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-04-11 05:12:53 +0200
commit532e961f7ec04d9490e11c16a9efac8aed4f0585 (patch)
tree3f75ddf624a4ba18270b595617672a223c244d60 /networking/tftp.c
parent24ec952f1403759af280661b83471b28f1158553 (diff)
downloadbusybox-532e961f7ec04d9490e11c16a9efac8aed4f0585.tar.gz
tftpd: add -l "log to syslog" option. Needed for inetd mode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/tftp.c')
-rw-r--r--networking/tftp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/networking/tftp.c b/networking/tftp.c
index e50d9254b..9080c442f 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -43,13 +43,14 @@
//usage: "\n"
//usage: "tftpd should be used as an inetd service.\n"
//usage: "tftpd's line for inetd.conf:\n"
-//usage: " 69 dgram udp nowait root tftpd tftpd /files/to/serve\n"
+//usage: " 69 dgram udp nowait root tftpd tftpd -l /files/to/serve\n"
//usage: "It also can be ran from udpsvd:\n"
//usage: " udpsvd -vE 0.0.0.0 69 tftpd /files/to/serve\n"
//usage: "\nOptions:"
//usage: "\n -r Prohibit upload"
//usage: "\n -c Allow file creation via upload"
//usage: "\n -u Access files as USER"
+//usage: "\n -l Log to syslog (inetd mode requires this)"
#include "libbb.h"
@@ -92,6 +93,7 @@ enum {
TFTPD_OPT_r = (1 << 8) * ENABLE_TFTPD,
TFTPD_OPT_c = (1 << 9) * ENABLE_TFTPD,
TFTPD_OPT_u = (1 << 10) * ENABLE_TFTPD,
+ TFTPD_OPT_l = (1 << 11) * ENABLE_TFTPD,
};
#if ENABLE_FEATURE_TFTP_GET && !ENABLE_FEATURE_TFTP_PUT
@@ -782,8 +784,12 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
peer_lsa->len = our_lsa->len;
/* Shifting to not collide with TFTP_OPTs */
- opt = option_mask32 = TFTPD_OPT | (getopt32(argv, "rcu:", &user_opt) << 8);
+ opt = option_mask32 = TFTPD_OPT | (getopt32(argv, "rcu:l", &user_opt) << 8);
argv += optind;
+ if (opt & TFTPD_OPT_l) {
+ openlog(applet_name, LOG_PID, LOG_DAEMON);
+ logmode = LOGMODE_SYSLOG;
+ }
if (argv[0])
xchdir(argv[0]);