Fixing to not drop the isatty check that was there.

This commit is contained in:
Ted Gould 2012-09-07 08:11:33 -05:00
parent 74306c93cb
commit 241b8af9e8
1 changed files with 9 additions and 5 deletions

View File

@ -879,11 +879,15 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
}
/* password */
if (NULL == settings->password) {
char input[512];
input[0] = '\0';
printf("password: ");
if (scanf("%511s", input) > 0) {
settings->password = xstrdup(input);
settings->password = xmalloc(512 * sizeof(char));
if (isatty(STDIN_FILENO))
freerdp_passphrase_read("password: ", settings->password, 512, settings->from_stdin);
else {
printf("password: ");
if (scanf("%511s", settings->password) <= 0) {
free(settings->password);
settings->password = NULL;
}
}
}
/* domain */