On Linux, hitting ^C on any of the password prompts now leaves ECHO
disabled, so the user needs to run "stty sane". Restore the correct
settings prior to exiting.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
tcsetattr(fd, TCSANOW, &t);
}
- if (!fgets(buf, 1025, stdin)) {
- perror(_("fgets (stdin)"));
- exit(1);
- }
+ buf = fgets(buf, 1025, stdin);
if (hidden) {
t.c_lflag |= ECHO;
fprintf(stderr, "\n");
}
+ if (!buf) {
+ perror(_("fgets (stdin)"));
+ exit(1);
+ }
+
c = strchr(buf, '\n');
if (c)
*c = 0;