004-fix-su-controoling-term.patch 407 B

12345678910111213141516
  1. --- a/src/su.c
  2. +++ b/src/su.c
  3. @@ -1090,8 +1090,12 @@
  4. if (fd >= 0) {
  5. err = ioctl (fd, TIOCNOTTY, (char *) 0);
  6. + if (-1 == err && ENOTTY == errno) {
  7. + /* There are no controlling terminal already */
  8. + err = 0;
  9. + }
  10. (void) close (fd);
  11. - } else if (ENXIO == errno) {
  12. + } else if (ENXIO == errno || EACCES == errno) {
  13. /* There are no controlling terminal already */
  14. err = 0;
  15. }