reassign 573063 libc0.1
tags 573063 +pending
--
in libkpty (kde4libs/kpty/kpty.c), there is a call to openpty:
(this is compiled with g++)
::openpty( &d->masterFd, &d->slaveFd, ptsn, 0, 0)
(d is a pointer to a struct, d->masterFd is a int, d->slaveFd is a
int, ptsn is a char pointer)
which fails with EINTR (according to errno)
[..]
I'm out of clue and/or inspiration.
My possibly-clueless 2?: If EINTR is returned, the call should be
retried, which this code doesn't seem to do.
I tried with wrapping it in a bit of goto magic, and I just got a loop
that seemed infinite. I stopped it after ~50 tries.
tryagain:
if (openpty( &d->masterFd, &d->slaveFd, ptsn, NULL, NULL))
{
int errsv = errno;
perror(__PRETTY_FUNCTION__);
if(errsv == EINTR) {
sleep(1);
goto tryagain;
}
[....]
The EINTR should really be handled, but the proper place is eglibc.
The patch bellow fixes konsole for me,
I will commit it into pkg-glibc SVN after some more testing.
I expect that difference between xterm and konsole is whether SIGCHLD
does have explicit handler.
Many thanks for your investigation.
Petr
--- a/sysdeps/unix/grantpt.c
+++ b/sysdeps/unix/grantpt.c
@@ -200,9 +200,13 @@
else
{
int w;
-
+retry:
if (__waitpid (pid, &w, 0) == -1)
+ {
+ if (errno == EINTR)
+ goto retry;
goto cleanup;
+ };
if (!WIFEXITED (w))
__set_errno (ENOEXEC);
else
man waitpid:
EINTR WNOHANG was not set and an unblocked signal
or a SIGCHLD was caught; see signal(7).