From: jan Date: Thu, 20 May 2021 15:21:03 +0000 (+0000) Subject: Removes the useless FILE* parameter of get_line(). X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=330fc432c494bf33500098ef1effbe5aca7c1ab3;p=openbsd Removes the useless FILE* parameter of get_line(). While here fix minor whitespace mistake. "looks fine to me" chris@ --- diff --git a/libexec/ftpd/extern.h b/libexec/ftpd/extern.h index 3587af7dc28..0acafe955b8 100644 --- a/libexec/ftpd/extern.h +++ b/libexec/ftpd/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.21 2020/01/15 22:06:59 jan Exp $ */ +/* $OpenBSD: extern.h,v 1.22 2021/05/20 15:21:03 jan Exp $ */ /* $NetBSD: extern.h,v 1.2 1995/04/11 02:44:49 cgd Exp $ */ /* @@ -69,7 +69,7 @@ void dologout(int); void fatal(char *); int ftpd_pclose(FILE *, pid_t); FILE *ftpd_ls(const char *, pid_t *); -int get_line(char *, int, FILE *); +int get_line(char *, int); void ftpdlogwtmp(char *, char *, char *); void lreply(int, const char *, ...); void makedir(char *); diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y index cc531fa51b8..a8f0e5f88ce 100644 --- a/libexec/ftpd/ftpcmd.y +++ b/libexec/ftpd/ftpcmd.y @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpcmd.y,v 1.69 2020/03/04 20:17:48 millert Exp $ */ +/* $OpenBSD: ftpcmd.y,v 1.70 2021/05/20 15:21:03 jan Exp $ */ /* $NetBSD: ftpcmd.y,v 1.7 1996/04/08 19:03:11 jtc Exp $ */ /* @@ -1089,10 +1089,9 @@ lookup(p, cmd) * get_line - a hacked up version of fgets to ignore TELNET escape codes. */ int -get_line(s, n, iop) +get_line(s, n) char *s; int n; - FILE *iop; { int c; char *cs; @@ -1111,21 +1110,21 @@ get_line(s, n, iop) if (c == 0) tmpline[0] = '\0'; } - while ((c = getc(iop)) != EOF) { + while ((c = getc(stdin)) != EOF) { c &= 0377; if (c == IAC) { - if ((c = getc(iop)) != EOF) { + if ((c = getc(stdin)) != EOF) { c &= 0377; switch (c) { case WILL: case WONT: - c = getc(iop); + c = getc(stdin); printf("%c%c%c", IAC, DONT, 0377&c); (void) fflush(stdout); continue; case DO: case DONT: - c = getc(iop); + c = getc(stdin); printf("%c%c%c", IAC, WONT, 0377&c); (void) fflush(stdout); continue; @@ -1144,7 +1143,7 @@ get_line(s, n, iop) * This prevents the command to be split up into * multiple commands. */ - while (c != '\n' && (c = getc(iop)) != EOF) + while (c != '\n' && (c = getc(stdin)) != EOF) ; return (-2); } @@ -1204,7 +1203,7 @@ yylex() case CMD: (void) alarm((unsigned) timeout); - n = get_line(cbuf, sizeof(cbuf)-1, stdin); + n = get_line(cbuf, sizeof(cbuf)-1); if (n == -1) { reply(221, "You could at least say goodbye."); dologout(0); diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 7fba613baf9..0da0d337f46 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.229 2020/01/15 22:06:59 jan Exp $ */ +/* $OpenBSD: ftpd.c,v 1.230 2021/05/20 15:21:03 jan Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -2179,7 +2179,7 @@ myoob(void) if (!transflag) return; cp = tmpline; - ret = get_line(cp, sizeof(tmpline)-1, stdin); + ret = get_line(cp, sizeof(tmpline)-1); if (ret == -1) { reply(221, "You could at least say goodbye."); dologout(0); diff --git a/libexec/ftpd/monitor.c b/libexec/ftpd/monitor.c index 205a6d2943e..ecd4afb5947 100644 --- a/libexec/ftpd/monitor.c +++ b/libexec/ftpd/monitor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monitor.c,v 1.27 2021/05/15 13:37:43 jan Exp $ */ +/* $OpenBSD: monitor.c,v 1.28 2021/05/20 15:21:03 jan Exp $ */ /* * Copyright (c) 2004 Moritz Jodeit @@ -296,7 +296,7 @@ handle_cmds(void) break; case AUTH_SLAVE: if (pledge("stdio rpath wpath cpath inet recvfd" - " sendfd proc tty getpw", NULL) == -1) + " sendfd proc tty getpw", NULL) == -1) fatalx("pledge"); /* User-privileged slave */ debugmsg("user-privileged slave started");