passphrase_read_propmts_to_tty: open the slave device before closing the rest

This commit is contained in:
Shea Levy 2011-09-24 00:39:20 -04:00
parent d9391d33c1
commit f16b7a9b60

View File

@ -195,12 +195,12 @@ void passphrase_read_prompts_to_tty()
if (setsid() == (pid_t) -1)
CU_FAIL_FATAL("Could not create new session");
if ((slavefd = open(slavedevice, O_RDWR)) == 0)
CU_FAIL_FATAL("Could not open slave end of pty");
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
close(masterfd);
if ((slavefd = open(slavedevice, O_RDWR)) == 0)
CU_FAIL_FATAL("Could not open slave end of pty");
freerdp_passphrase_read("Password: ", buffer, password_size);
close(slavefd);
exit(EXIT_SUCCESS);