lkml.org 
[lkml]   [2009]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Regression] kdesu broken
On Sat, 25 Jul 2009 15:04:06 +0900
> I also was seeing this. I hope the attached test code shows the problem.

It does for me: I've been using the test attached below from the Emacs 21
for Mac OS X web site where MacOS developed the same behaviour

> input_available_p()
> # buffer was not received yet
> test_bit(TTY_OTHER_CLOSED)
> return -EIO
>
> flush_to_ldisc()
> ->receive_buf()
>
> master is having the input data in tty->buf, but ->receive_buf() is not
> called yet. So, it seems to return -EIO before handling input data in
> tty->buf.

Would make sense. Just investigating that now.

-----------

#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv) {
pid_t pid;
int master;
char buf[101];
int n;

pid = forkpty(&master, NULL, NULL, NULL);
if(pid < 0) {
perror("fork error");
exit(-1);
} else if(pid == 0) {
printf("### This is the child process ###\n"); // To be read by parent
fflush(stdout); // Doesn't help.
sleep(1); // Shouldn't be needed, but it makes things work.
return(0);
} else {
while(n = read(master, buf, 100)) {
if(n < 0) {
perror("read error");
exit(-1);
}
buf[n] = 0; // Make a string out of our data.
printf("Read %d bytes: %s", n, buf);
}
}
exit(0);
}


\
 
 \ /
  Last update: 2009-07-25 15:33    [W:0.786 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site