Don't use gets().
sys_curses/system.c: Don't use gets() better. Neither gets() nor fgets() is appropriate for discarding a line of input.
This commit is contained in:
parent
6ef8b8ca0c
commit
89e45c9b7f
@ -749,7 +749,12 @@ struct SREGS *sregs;
|
||||
Dump('>', (char *)regs, sizeof *regs);
|
||||
Dump('>', (char *)sregs, sizeof *sregs);
|
||||
#ifdef MSDOS
|
||||
{ char buf[10]; gets(buf); }
|
||||
{
|
||||
int ch;
|
||||
|
||||
while ((ch = getchar()) != '\n' && ch != EOF)
|
||||
;
|
||||
}
|
||||
#endif /* MSDOS */
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ shell_continue()
|
||||
handle_api(&spinted.regs, &spinted.sregs);
|
||||
spint_continue(&spinted);
|
||||
} else {
|
||||
char inputbuffer[100];
|
||||
int ch;
|
||||
|
||||
if (spinted.rc != 0) {
|
||||
fprintf(stderr, "Process generated a return code of 0x%x.\n",
|
||||
@ -82,7 +82,8 @@ shell_continue()
|
||||
}
|
||||
printf("[Hit return to continue]");
|
||||
fflush(stdout);
|
||||
(void) gets(inputbuffer);
|
||||
while ((ch = getchar()) != '\n' && ch != EOF)
|
||||
;
|
||||
shell_active = 0;
|
||||
setconnmode();
|
||||
ConnectScreen();
|
||||
|
@ -593,7 +593,7 @@ child_died(code)
|
||||
|
||||
while ((pid = wait3((int *)&status, WNOHANG, (struct rusage *)0)) > 0) {
|
||||
if (pid == shell_pid) {
|
||||
char inputbuffer[100];
|
||||
int ch;
|
||||
extern void setconnmode();
|
||||
extern void ConnectScreen();
|
||||
|
||||
@ -604,7 +604,8 @@ child_died(code)
|
||||
}
|
||||
printf("[Hit return to continue]");
|
||||
fflush(stdout);
|
||||
(void) fgets(inputbuffer, sizeof(inputbuffer), stdin);
|
||||
while ((ch = getchar()) != '\n' && ch != EOF)
|
||||
;
|
||||
setconnmode();
|
||||
ConnectScreen(); /* Turn screen on (if need be) */
|
||||
(void) close(serversock);
|
||||
|
@ -257,7 +257,7 @@ char *aidfile, *fcnfile;
|
||||
}
|
||||
scanwhite(fcnfile, "FCN_");
|
||||
|
||||
while (gets(line) != NULL) {
|
||||
while (fgets(line, sizeof line, stdin) != NULL) {
|
||||
if (!isdigit(line[0])) {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user