diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2024-01-04 17:46:49 +0100 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2024-01-04 17:46:49 +0100 |
commit | 8a400c3d15a1beefb2d804c176b806566091ded8 (patch) | |
tree | b357e542ec1bead3094abee16174881a312453fb | |
parent | 4fbed4be20377e5b1a6e71f572eb28ed049ed3fe (diff) | |
download | pam-8a400c3d15a1beefb2d804c176b806566091ded8.tar.gz pam-8a400c3d15a1beefb2d804c176b806566091ded8.tar.bz2 pam-8a400c3d15a1beefb2d804c176b806566091ded8.zip |
pam_filter: drop invalid tty hack
The open(3) flag O_NOCTTY does not detach the calling process from the
opened file descriptor, like TIOCNOTTY, see tty(4), does.
Drop the invalid hack to avoid the file descriptor being leaked.
Reported by cppcheck.
-rw-r--r-- | modules/pam_filter/pam_filter.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/modules/pam_filter/pam_filter.c b/modules/pam_filter/pam_filter.c index 4f3f222e..62b118bb 100644 --- a/modules/pam_filter/pam_filter.c +++ b/modules/pam_filter/pam_filter.c @@ -312,16 +312,11 @@ set_filter (pam_handle_t *pamh, int flags UNUSED, int ctrl, if (aterminal) { /* close the controlling tty */ - -#if defined(__hpux) && defined(O_NOCTTY) - int t = open("/dev/tty", O_RDWR|O_NOCTTY); -#else int t = open("/dev/tty",O_RDWR); if (t >= 0) { (void) ioctl(t, TIOCNOTTY, NULL); close(t); } -#endif /* defined(__hpux) && defined(O_NOCTTY) */ /* make this process it's own process leader */ if (setsid() == -1) { |