diff options
author | iedowse <iedowse@FreeBSD.org> | 2000-12-12 12:04:02 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2000-12-12 12:04:02 +0000 |
commit | a507515e083a208609badf2032b1cf4a61571fc5 (patch) | |
tree | 94a9260b8ef2a70ef3a47ebefed8a70ab8b5ea54 /sbin/restore/interactive.c | |
parent | 513cdb008249fa2a1faeb31a407c87138df1cd2b (diff) | |
download | FreeBSD-src-a507515e083a208609badf2032b1cf4a61571fc5.zip FreeBSD-src-a507515e083a208609badf2032b1cf4a61571fc5.tar.gz |
Stop restore from looping under certain error conditions. This
corrects cases where restore would spew an infinite stream of
"Changing volumes on pipe input?" messages, or would loop waiting
for a response to the "set owner/mode for '.'" question.
PR: bin/14250
Reviewed by: dwmalone
Diffstat (limited to 'sbin/restore/interactive.c')
-rw-r--r-- | sbin/restore/interactive.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sbin/restore/interactive.c b/sbin/restore/interactive.c index ca0bc84..1fd8930 100644 --- a/sbin/restore/interactive.c +++ b/sbin/restore/interactive.c @@ -325,12 +325,11 @@ getcmd(curdir, cmd, name, size, ap) do { fprintf(stderr, "restore > "); (void) fflush(stderr); - (void) fgets(input, BUFSIZ, terminal); - } while (!feof(terminal) && input[0] == '\n'); - if (feof(terminal)) { - (void) strcpy(cmd, "quit"); - return; - } + if (fgets(input, BUFSIZ, terminal) == NULL) { + strcpy(cmd, "quit"); + return; + } + } while (input[0] == '\n'); for (cp = &input[strlen(input) - 2]; *cp == ' ' || *cp == '\t'; cp--) /* trim off trailing white space and newline */; *++cp = '\0'; |