diff options
author | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2002-01-28 19:28:14 +0000 |
---|---|---|
committer | Yaroslav Tykhiy <ytykhiy@gmail.com> | 2002-01-28 19:28:14 +0000 |
commit | 4b82fc955f15e8f0aeeecab222072b8c1898f422 (patch) | |
tree | cc70648d56369afdd2a65f52ef411514cf29abda /libexec/ftpd/ftpcmd.y | |
parent | 5cc5c73a0337b05bae63bd8416f107a910c4294e (diff) | |
download | src-4b82fc955f15e8f0aeeecab222072b8c1898f422.tar.gz src-4b82fc955f15e8f0aeeecab222072b8c1898f422.zip |
Remove the setjmp/longjmp stuff completely. Use signal
handlers to set flags only (with exception for sigquit(),
which still seems to call some non-reentrant functions on
its way to _exit(2).) That must eliminate the possibility
of catching SIGSEGV from following non-reentrant paths from
signal handlers.
PR: bin/32740 bin/33846
Submitted by: Maxim Konovalov <maxim@macomnet.ru>
Obtained from: OpenBSD
Notes
Notes:
svn path=/head/; revision=89935
Diffstat (limited to 'libexec/ftpd/ftpcmd.y')
-rw-r--r-- | libexec/ftpd/ftpcmd.y | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y index 687e3a0964ec..5928c028c9d3 100644 --- a/libexec/ftpd/ftpcmd.y +++ b/libexec/ftpd/ftpcmd.y @@ -60,7 +60,6 @@ static const char rcsid[] = #include <glob.h> #include <netdb.h> #include <pwd.h> -#include <setjmp.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -101,6 +100,7 @@ off_t restart_point; static int cmd_type; static int cmd_form; static int cmd_bytesz; +static int state; char cbuf[512]; char *fromname = (char *) 0; @@ -750,9 +750,11 @@ cmd reply(221, "Goodbye."); dologout(0); } - | error CRLF + | error { - yyerrok; + yyclearin; /* discard lookahead data */ + yyerrok; /* clear error condition */ + state = 0; /* reset lexer state */ } ; rcmd @@ -1047,8 +1049,6 @@ check_login_ro %% -extern jmp_buf errcatch; - #define CMD 0 /* beginning of command */ #define ARGS 1 /* expect miscellaneous arguments */ #define STR1 2 /* expect SP followed by STRING */ @@ -1253,7 +1253,7 @@ toolong(signo) static int yylex() { - static int cpos, state; + static int cpos; char *cp, *cp2; struct tab *p; int n; @@ -1290,8 +1290,7 @@ yylex() if (p != 0) { if (p->implemented == 0) { nack(p->name); - longjmp(errcatch,0); - /* NOTREACHED */ + return (LEXERR); } state = p->state; yylval.s = p->name; @@ -1316,8 +1315,7 @@ yylex() if (p->implemented == 0) { state = CMD; nack(p->name); - longjmp(errcatch,0); - /* NOTREACHED */ + return (LEXERR); } state = p->state; yylval.s = p->name; @@ -1467,9 +1465,8 @@ yylex() default: fatalerror("Unknown state in scanner."); } - yyerror((char *) 0); state = CMD; - longjmp(errcatch,0); + return (LEXERR); } } |