Commit 4a257d8c authored by Milan Broz's avatar Milan Broz

Print error when getline() fails (thanks to Ivan Stankovic)



git-svn-id: https://cryptsetup.googlecode.com/svn/[email protected] 36d66b0a-2a48-0410-832c-cd162a569da5
parent f60475e2
2009-07-30 Milan Broz <[email protected]>
* Fix errors when compiled with LUKS_DEBUG.
* Print error when getline fails.
2009-07-28 Milan Broz <[email protected]>
* Pad luks header to 512 sector size.
......
......@@ -79,19 +79,23 @@ static struct action_type {
/* Interface Callbacks */
static int yesDialog(char *msg)
{
int r = 0;
char *answer = NULL;
size_t size = 0;
int r = 1;
if(isatty(0) && !opt_batch_mode) {
char *answer=NULL;
size_t size=0;
fprintf(stderr,"\nWARNING!\n========\n");
fprintf(stderr,"%s\n\nAre you sure? (Type uppercase yes): ",msg);
if(getline(&answer,&size,stdin) == -1)
fprintf(stderr, "\nWARNING!\n========\n");
fprintf(stderr, "%s\n\nAre you sure? (Type uppercase yes): ", msg);
if(getline(&answer, &size, stdin) == -1) {
perror("getline");
free(answer);
return 0;
if(strcmp(answer,"YES\n") == 0)
r = 1;
}
if(strcmp(answer, "YES\n"))
r = 0;
free(answer);
} else
r = 1;
}
return r;
}
......
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