Commit dc4d945e authored by Milan Broz's avatar Milan Broz

Fix error handling during reading passhrase.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@154 36d66b0a-2a48-0410-832c-cd162a569da5
parent 40355926
2009-12-11 Milan Broz <mbroz@redhat.com>
* Fix error handling during reading passhrase.
2009-12-01 Milan Broz <mbroz@redhat.com>
* Allow changes of default compiled-in cipher parameters through configure.
* Switch default key size for LUKS to 256bits.
......
......@@ -403,6 +403,7 @@ void get_key(char *prompt, char **key, unsigned int *passLen, int key_size,
int newline_stop;
int read_horizon;
int regular_file = 0;
int r;
if(key_file && !strcmp(key_file, "-")) {
/* Allow binary reading from stdin */
......@@ -487,7 +488,14 @@ void get_key(char *prompt, char **key, unsigned int *passLen, int key_size,
goto out_err;
}
}
if(read(fd, pass + i, 1) != 1 || (newline_stop && pass[i] == '\n'))
r = read(fd, pass + i, 1);
if (r < 0) {
log_err(cd, _("Error reading passphrase.\n"));
goto out_err;
}
if(r == 0 || (newline_stop && pass[i] == '\n'))
break;
}
if(key_file)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment