summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-11-01 00:22:24 +0000
committerDenis Vlasenko2008-11-01 00:22:24 +0000
commit5a89763fb7e57d4fc3d393eafa35c58f8285a083 (patch)
tree8b1e93ed2685ff31c32e851871a6a57dda4fbcea
parent44d5dcebc6d3d896e8a5de07cb57913d961067c8 (diff)
downloadbusybox-5a89763fb7e57d4fc3d393eafa35c58f8285a083.zip
busybox-5a89763fb7e57d4fc3d393eafa35c58f8285a083.tar.gz
tftpd: show help if stdin is not a socket
-rw-r--r--networking/tftp.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/networking/tftp.c b/networking/tftp.c
index 07d672d..eb39e9c 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -653,8 +653,15 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
INIT_G();
our_lsa = get_sock_lsa(STDIN_FILENO);
- if (!our_lsa)
- bb_perror_msg_and_die("stdin is not a socket");
+ if (!our_lsa) {
+ /* This is confusing:
+ *bb_error_msg_and_die("stdin is not a socket");
+ * Better: */
+ bb_show_usage();
+ /* Help text says that tftpd must be used as inetd service,
+ * which is by far the most usual cause of get_sock_lsa
+ * failure */
+ }
peer_lsa = xzalloc(LSA_LEN_SIZE + our_lsa->len);
peer_lsa->len = our_lsa->len;