From f16b7a9b60e5b95cd88a71a2655dfe85237fd91d Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sat, 24 Sep 2011 00:39:20 -0400 Subject: [PATCH] passphrase_read_propmts_to_tty: open the slave device before closing the rest --- cunit/test_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cunit/test_utils.c b/cunit/test_utils.c index bd0a3f8..634d9e4 100644 --- a/cunit/test_utils.c +++ b/cunit/test_utils.c @@ -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); -- 2.7.4