Re: [Regression] kdesu broken

From: Alan Cox
Date: Sat Jul 25 2009 - 09:31:24 EST


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);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/