diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/security.c | 14 | ||||
-rw-r--r-- | src/security.h | 3 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/security.c b/src/security.c index 33342fc..5620749 100644 --- a/src/security.c +++ b/src/security.c @@ -94,9 +94,11 @@ void chown_tty(uid_t owner, gid_t group, int with_fail) if (ioctl(STDIN_FILENO, VT_GETSTATE, &vtstat) == 0) { int n = vtstat.v_active; - char vcs[16]; - char vcsa[16]; + char _vcs[16]; + char _vcsa[16]; + char* vcs = _vcs; + char* vcsa = _vcsa; vcs += 16; vcsa += 16; @@ -114,10 +116,10 @@ void chown_tty(uid_t owner, gid_t group, int with_fail) strcpy(vcs, "/dev/vcs"); strcpy(vcsa, "/dev/vcsa"); - if (fchown(vcs, owner, group) && with_fail) fail("chown"); - if (fchown(vcsa, owner, group) && with_fail) fail("chown"); - if (fchmod(vcs, TTY_PERM) && with_fail) fail("chmod"); - if (fchmod(vcsa, TTY_PERM) && with_fail) fail("chmod"); + if (chown(vcs, owner, group) && with_fail) fail("chown"); + if (chown(vcsa, owner, group) && with_fail) fail("chown"); + if (chmod(vcs, TTY_PERM) && with_fail) fail("chmod"); + if (chmod(vcsa, TTY_PERM) && with_fail) fail("chmod"); } } } diff --git a/src/security.h b/src/security.h index 464afbf..b16ef1b 100644 --- a/src/security.h +++ b/src/security.h @@ -22,6 +22,9 @@ #include <termios.h> #include <fcntl.h> #include <signal.h> +#include <string.h> +#include <stropts.h> +#include <linux/vt.h> #ifndef TTY_PERM |