+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.
int newline_stop;
int read_horizon;
int regular_file = 0;
+ int r;
if(key_file && !strcmp(key_file, "-")) {
/* Allow binary reading from stdin */
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)