Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bug in /dev/null

0 views
Skip to first unread message

Frank van Maarseveen

unread,
Jan 7, 1999, 3:00:00 AM1/7/99
to
On Solaris 2.5.1 the following program behaves differently depending
on redirecting standard input from /dev/null or from an empty file.
When redirected from an empty file select() immediately returns 1,
indicating that fd 0 can be read which is correct behaviour. However,
when redirecting input from /dev/null select times out after two seconds
as if it makes sense to wait for data to appear.

I suppose select() waits for the bug to come out ;-)

Any clues?

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/time.h>
#include <errno.h>
void main()
{
fd_set readfds;
int n;
struct timeval tv;

FD_ZERO(&readfds);
FD_SET(0, &readfds);
tv.tv_sec = 2;
tv.tv_usec = 0;
n = select(1, &readfds, NULL, NULL, &tv);
printf("n=%d, errno=%d\n", n, errno);
}

--
Frank van Maarseveen Senior Software Engineer
---------------------------------------------------------------------------
E-mail: frank_van_...@tasking.com
WWW: http://www.tasking.com
---------------------------------------------------------------------------

Casper H.S. Dik - Network Security Engineer

unread,
Jan 7, 1999, 3:00:00 AM1/7/99
to
[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]

f...@tasking.nl (Frank van Maarseveen) writes:

>On Solaris 2.5.1 the following program behaves differently depending
>on redirecting standard input from /dev/null or from an empty file.
>When redirected from an empty file select() immediately returns 1,
>indicating that fd 0 can be read which is correct behaviour. However,
>when redirecting input from /dev/null select times out after two seconds
>as if it makes sense to wait for data to appear.

>I suppose select() waits for the bug to come out ;-)


It's a bug (it is marked as fixed but somehow it never got fixed)

1171830 (I've now filed a new one: 4201274)

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

0 new messages