From f6e018497f73fc55a84ba9cd2109e0fd776b715a Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Thu, 20 Apr 1995 05:38:58 +0000 Subject: [PATCH] Use port 21 as default if getservbyname fails to find it for us. This let us remove some crud from the install-procedure. --- usr.bin/ftp/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c index 7f2165d9b12e..98bc4d1d36b0 100644 --- a/usr.bin/ftp/main.c +++ b/usr.bin/ftp/main.c @@ -70,10 +70,14 @@ main(argc, argv) int ch, top; struct passwd *pw = NULL; char *cp, homedir[MAXPATHLEN]; + struct servent sp_default; sp = getservbyname("ftp", "tcp"); - if (sp == 0) - errx(1, "ftp/tcp: unknown service"); + if (sp == 0) { + sp = &sp_default; + memset(sp, 0, sizeof *sp); + sp->s_port = htons(21); + } doglob = 1; interactive = 1; autologin = 1;