Bug#42986: [Konsole-devel] Bug#42986: dup2() in freebsd
Waldo Bastian
bastian at kde.org
Sun Sep 1 06:18:20 UTC 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 29 August 2002 11:07 pm, Michael Samuel wrote:
> Ok, I figured it out.
>
> The dup2() it's using is from libc_r, which is the thread library on
> FreeBSD.
>
> In the libc_r wrapper, there's this code:
>
> /* Check if the file descriptor is out of range: */
> if (newfd < 0 || newfd >= _thread_dtablesize ||
> newfd == _thread_kern_pipe[0] || newfd == _thread_kern_pipe[1])
> { /* Return a bad file descriptor error: */
> errno = EBADF;
> ret = -1;
> }
>
> Any guesses what numbers are in _thread_kern_pipe[0] and
> _thread_kern_pipe[1] (which are setup shortly after setting up stdin,
> stdout and stderr)?
>
> So, when I changed PTY_FILENO to 15, it now works :)
Remarkable.
> Of course, that doesn't fix the race condition still present on all
> systems. (what happens if somebody opens the tty device before we do the
> chown, but after we open the pty master?)
I have no idea how any of this is supposed to work.
Cheers,
Waldo
- --
bastian at kde.org | SuSE Labs KDE Developer | bastian at suse.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE9cbEsN4pvrENfboIRAp7gAJ4+t9pKaq93JWJpR4aRf77Qj29boQCfeqbl
jrI1KNxmrj7zDlCvsTz5cqU=
=teoN
-----END PGP SIGNATURE-----
(Complete bug history is available at http://bugs.kde.org/db/42/42986.html)
More information about the konsole-devel
mailing list