* BUG[?]: select() for reading from unattached FIFO
@ 1994-07-06 12:27 Michael D. Tan
1994-07-07 6:37 ` Burkhard Neidecker-Lutz
0 siblings, 1 reply; 2+ messages in thread
From: Michael D. Tan @ 1994-07-06 12:27 UTC (permalink / raw)
Can anyone else confirm this bug? I have a FIFO which I have opened
for reading on one side using O_RDONLY | O_NDELAY. No writers are
attached to the FIFO yet. When I do a select() for reading on this
FIFO, select() returns that the FIFO is ready for reading, but a
read() returns nothing (correctly). In SunOS, select() *doesn't* say
the FIFO is readable, but my same test program in OSF/1 v2.0 says it
is. This is a bug, isn't it?
Thanks.
Michael Tan
mdtanx@cs.umd.edu
Here's the test program:
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
main() {
int fd,;
fd_set readfds;
unlink("AFIFO");
mkfifo("AFIFO", 0660);
if ((fd = open("AFIFO", O_RDONLY | O_NDELAY)) < 0)
{
printf("open for workin failed\n");
exit (-1);
}
FD_ZERO(&readfds);
FD_SET(fd, &readfds);
select(fd+1, &readfds, NULL, NULL, NULL);
if (FD_ISSET(fd, &readfds))
{
char ss[200];
int amt;
ss[0] = '\0';
printf("fd was set\n");
if ((amt = read(fd, ss, 200)) < 0)
printf("read error %d\n", errno);
printf("Read %d bytes: %s\n", amt, ss);
}
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1994-07-07 6:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-07-06 12:27 BUG[?]: select() for reading from unattached FIFO Michael D. Tan
1994-07-07 6:37 ` Burkhard Neidecker-Lutz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox