diff options
author | Mattias Andrée <maandree@operamail.com> | 2013-11-22 07:57:30 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2013-11-22 07:57:30 +0100 |
commit | d10cd71d3758e56ed7d59e42ec9392fed2573937 (patch) | |
tree | 9afeeb343974009b4fc12572fabd8b92b3858b98 /src/cerberus.c | |
parent | m (diff) | |
download | libpassphrase-d10cd71d3758e56ed7d59e42ec9392fed2573937.tar.gz libpassphrase-d10cd71d3758e56ed7d59e42ec9392fed2573937.tar.bz2 libpassphrase-d10cd71d3758e56ed7d59e42ec9392fed2573937.tar.xz |
fix chmod and chown of tty device files
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/cerberus.c')
-rw-r--r-- | src/cerberus.c | 12 |
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); |