aboutsummaryrefslogtreecommitdiffstats
path: root/src/cerberus.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cerberus.c')
-rw-r--r--src/cerberus.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cerberus.c b/src/cerberus.c
index f20e600..e52a48f 100644
--- a/src/cerberus.c
+++ b/src/cerberus.c
@@ -53,6 +53,8 @@ char* passphrase = NULL;
*/
int main(int argc, char** argv)
{
+ char* tty_device = ttyname(STDIN_FILENO);
+
do_login(argc, argv);
/* Ignore signals */
@@ -63,6 +65,16 @@ int main(int argc, char** argv)
while ((wait(NULL) == -1) && (errno == EINTR))
;
+ /* Regain access to the terminal */
+ if (tty_device)
+ {
+ int fd = open(tty_device, O_RDWR | O_NONBLOCK);
+ if (fd)
+ dup2(fd, 0);
+ dup2(fd, 1);
+ dup2(fd, 2);
+ }
+
/* Reset terminal ownership and mode */
chown_tty(0, tty_group, 0);