/*
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);
}