Re: accept() doesn't block as it should in 2.3.x kernels

John Anthony Kazos Jr. (jkazos@vt.edu)
Sun, 12 Dec 1999 19:04:05 -0500 (EST)


On Sun, 12 Dec 1999, Pete Wyckoff wrote:
> root@chaos.analogic.com said:
> > > int sa2_len;
> > > struct sockaddr_un sa2;
> >
> > Here, the length of sa2, passed to accept via sa2_len is undefined.
> >
> > The length should be initialized to the length of the structure so
> > accept() knows how much space is available. Accept() is probably
> > getting a 0, returning a bogus error-code.
>
> Yes, sa2_len should be initialized. No, accept() does the right thing
> if it gets a bogus length (EINVAL). A zero length results in no copy
> into sa2, but the syscall completes without error. Read the source.

Why should the length be initialized to zero? According to the C++ standard,
int() is only called if doing something like

int * x = new int;

but not for local (stack) copies. Unless egcs doesn't follow the standard...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/