Hi Jean-Marie,
it looks rather like drivers/char/n_tty.c doesn't bother to check the return
value from put_user(). It's called three times in the file and none of the
calls check the return value. I suspect checking and propagating the return
value would fix this. In any case, no data should be transferred so it's only
the return status that's bad, rather than any actual corruption.
t
In message <[EMAIL PROTECTED]>,Jean-Marie Sulmont writes
:
> /*
> Bonjour,
>
> read(0,0,1) returns 1 as soon as 1 char has been keyed in.
> I'm using 2.1.124 SMP. Included is a little program illustrating it.
> The ext2 read operation is OK. Which operation is invoked when reading
> from 0 and 0 hasn't been redirected? Could not find it, so could not fix it.
> Let me know!
>
> jean-marie
> */
>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <errno.h>
> #include <stdio.h>
> #include <assert.h>
>
> main (int argc , char** argv)
> {
> char *x = 0;
> int fd, rc;
>
> #ifndef BUG
> fd = open(argv[0], O_RDONLY), assert( fd != -1 );
> #endif
> printf("before: errno=%d\n", errno);
> #ifdef BUG
> fd = 0;
> #endif
> rc = read (fd, 0, 1);
> printf("after : errno=%d\n", errno);
> if (rc == -1) perror ("read");
> else printf ("rc = %d\n", rc);
> exit(0);
> }
>
--
Tim Wright, Software Engineer, | Email: [EMAIL PROTECTED]
Sequent Computer Systems Inc., 15450, |
SW Koll Parkway, Beaverton, Oregon 97006 | Phone: +1-503-578-3822
"Law of Probability Dispersal: Whatever it is that hits the fan will not be
evenly distributed."