Consider this comment comes from screen(1):
/*
* Define this if your system exits select() immediatly if a pipe is
* opened read-only and no writer has opened it.
*/
#define BROKEN_PIPE 1
We have broken(?) pipe, according to this statement. At least, we have
select return code -1 with wrong errno == 0.
I attach the test for it below. The question is: what about our fifo
select (actually poll) implementation? Is it really broken, or is it a
feature? What standards says? If this is a feature, at least errno must be
fixed.
-----------------------------------------------------
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/stat.h>
char *fin = "/tmp/conftest$$";
main()
{
struct timeval tv;
int r, x;
unlink(fin);
if (mkfifo(fin, 0600))
exit(1);
close(0);
if (open(fin, O_RDONLY|O_NONBLOCK))
exit(1);
r = 1;
tv.tv_sec = 1;
tv.tv_usec = 0;
if (select(1, &r, 0, 0, &tv)) {
perror("select");
exit(1);
}
exit(0);
}
-----------------------------------------------------
--
Andrey A. Chernov
<[EMAIL PROTECTED]>
http://ache.pp.ru/
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message