Jeremie Courreges-Anglas wrote: > I think that's a better choice. > > > > >> > >> > -#else > >> > - while (fgets(line, sizeof(line), fd) != NULL) { > >> > - line[strcspn(line, "\n")] = '\0'; > >> > - lreply(530, "%s", line); > >> > - } > >> > - (void) fflush(stdout); > >> > - (void) close(fd); > > No need for the two lines above.
this flips the code. to make the changes easier to read, left the old code in place for a bit. that'll then be deleted. Index: ftpd.c =================================================================== RCS file: /cvs/src/libexec/ftpd/ftpd.c,v retrieving revision 1.220 diff -u -p -r1.220 ftpd.c --- ftpd.c 30 Aug 2016 14:56:39 -0000 1.220 +++ ftpd.c 30 Aug 2016 15:34:26 -0000 @@ -526,7 +526,7 @@ main(int argc, char *argv[]) } if (his_addr.su_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&his_addr.su_sin6.sin6_addr)) { -#if 1 +#if 0 /* * IPv4 control connection arrived to AF_INET6 socket. * I hate to do this, but this is the easiest solution. @@ -552,12 +552,10 @@ main(int argc, char *argv[]) sizeof(ctrl_addr.su_sin.sin_addr)); ctrl_addr.su_sin.sin_port = tmp_addr.su_sin6.sin6_port; #else - while (fgets(line, sizeof(line), fd) != NULL) { + while (fgets(line, sizeof(line), stdin) != NULL) { line[strcspn(line, "\n")] = '\0'; lreply(530, "%s", line); } - (void) fflush(stdout); - (void) close(fd); reply(530, "Connection from IPv4 mapped address is not supported."); exit(0);