Subject: kern/2428: socketpair() fails if fd0 open
To: None <gnats-bugs@NetBSD.ORG>
From: None <david@mono.org>
List: netbsd-bugs
Date: 05/17/1996 19:31:30
>Number: 2428
>Category: kern
>Synopsis: socketpair() fails if fd0 open
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri May 17 15:05:01 1996
>Last-Modified:
>Originator: David Brownlee
>Organization:
Monochrome (http://www.mono.org)
>Release: 1.1B
>Environment:
System: NetBSD orwell.southern.net 1.1B NetBSD/sparc 1.1B Tue Apr 2 1996 and on more recent 1.1B NetBSD/i386
>Description:
If fd 0 is open socketpair() fails. Bizarre, and also pretty
inconvenient if your application wants to use it!
>How-To-Repeat:
#include <sys/types.h>
#include <sys/socket.h>
main()
{
int sv[2];
if( socketpair(AF_UNIX,SOCK_STREAM,0,sv) )
perror("First call failed");
puts("Now close fd 0");
close(0);
if( socketpair(AF_UNIX,SOCK_STREAM,0,sv) )
perror("Second call failed");
}
>Fix:
Fix unknown - I've kludged around it by dup()ing fd0 somewhere else,
closing it, calling socketpair() then dup()ing ite back... uck...
>Audit-Trail:
>Unformatted: