diff options
author | Mattias Andrée <maandree@operamail.com> | 2013-11-18 18:10:18 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2013-11-18 18:10:18 +0100 |
commit | 7a57769211806d9f53b4c74f132fddfe98740b66 (patch) | |
tree | 66183541e03f8a1acaf95ccebb0b0b63f7755d85 /src/security.c | |
parent | fix errors (diff) | |
download | libpassphrase-7a57769211806d9f53b4c74f132fddfe98740b66.tar.gz libpassphrase-7a57769211806d9f53b4c74f132fddfe98740b66.tar.bz2 libpassphrase-7a57769211806d9f53b4c74f132fddfe98740b66.tar.xz |
confs
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/security.c')
-rw-r--r-- | src/security.c | 68 |
1 files changed, 37 insertions, 31 deletions
diff --git a/src/security.c b/src/security.c index 5620749..af7df30 100644 --- a/src/security.c +++ b/src/security.c @@ -91,36 +91,42 @@ void chown_tty(uid_t owner, gid_t group, int with_fail) fail("fchmod"); /* Also do the above for /dev/vcs[a][0-9]+ */ - if (ioctl(STDIN_FILENO, VT_GETSTATE, &vtstat) == 0) - { - int n = vtstat.v_active; - char _vcs[16]; - char _vcsa[16]; - - char* vcs = _vcs; - char* vcsa = _vcsa; - vcs += 16; - vcsa += 16; - - if (n) - { - *--vcs = *--vcsa = 0; - while (n) - { - *--vcs = *--vcsa = (n % 10) + '0'; - n /= 10; - } - - vcs -= 8; - vcsa -= 9; - strcpy(vcs, "/dev/vcs"); - strcpy(vcsa, "/dev/vcsa"); - - 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"); - } - } + #if defined(OWN_VCSA) || defined(OWN_VCS) + if (ioctl(STDIN_FILENO, VT_GETSTATE, &vtstat) == 0) + { + int n = vtstat.v_active; + char _vcs[16]; + char _vcsa[16]; + + char* vcs = _vcs; + char* vcsa = _vcsa; + vcs += 16; + vcsa += 16; + + if (n) + { + *--vcs = *--vcsa = 0; + while (n) + { + *--vcs = *--vcsa = (n % 10) + '0'; + n /= 10; + } + + vcs -= 8; + vcsa -= 9; + strcpy(vcs, "/dev/vcs"); + strcpy(vcsa, "/dev/vcsa"); + + #ifdef OWN_VCS + if (chown(vcs, owner, group) && with_fail) fail("chown"); + if (chmod(vcs, TTY_PERM) && with_fail) fail("chmod"); + #endif + #ifdef OWN_VCSA + if (chown(vcsa, owner, group) && with_fail) fail("chown"); + if (chmod(vcsa, TTY_PERM) && with_fail) fail("chmod"); + #endif + } + } + #endif } |