summaryrefslogtreecommitdiffstats
path: root/sbin/restore/interactive.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/restore/interactive.c')
-rw-r--r--sbin/restore/interactive.c11
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';
OpenPOWER on IntegriCloud