Skip to content

Commit

Permalink
Removes the useless FILE* parameter of get_line().
Browse files Browse the repository at this point in the history
While here fix minor whitespace mistake.

"looks fine to me" chris@
  • Loading branch information
younix committed May 20, 2021
1 parent 57331f1 commit 330fc43
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions libexec/ftpd/extern.h
Original file line number Diff line number Diff line change
@@ -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 $ */

/*
Expand Down Expand Up @@ -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 *);
Expand Down
17 changes: 8 additions & 9 deletions libexec/ftpd/ftpcmd.y
Original file line number Diff line number Diff line change
@@ -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 $ */

/*
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions libexec/ftpd/ftpd.c
Original file line number Diff line number Diff line change
@@ -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 $ */

/*
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions libexec/ftpd/monitor.c
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 330fc43

Please sign in to comment.