[Konsole-devel] Bug#42986: Problem with konsole_grantpty

Michael Samuel michael at miknet.net
Thu Aug 29 23:45:44 UTC 2002


I've spent a while tracking down the FreeBSD problem with chownpty, and
it seems that the problem is with the dup2() failing before spawning
konsole_grantpty. (When dup2() fails, you're just silently exiting,
rather than printing and error)

I can't see any reason why this would fail (it's failing and setting
errno to EBADF), and I even added some printf()s to my kernel code, and
the _only_ place where EBADF can be reported by the dup2 system call
isn't being hit.

The file descriptor is definately valid, as I added a fcntl(fd, F_GETFD)
right before the dup2(), and the fcntl succeeds.

I wrote a testcase program to try and duplicate the error, and was
unable to reproduce the problem.

I'm also not convinced that there isn't a race condition even when
chownpty does succeed (at-least with the Linux/*BSD method of obtaining
the pty devices), in the time between when the master device is openned,
and the time when the ownership/permissions are set.


(Complete bug history is available at http://bugs.kde.org/db/42/42986.html)



More information about the konsole-devel mailing list