IsBad*Ptr patch

Conrad Scott
Wed Aug 7 14:17:00 GMT 2002

"Christopher Faylor" <> wrote:
> On Wed, Aug 07, 2002 at 09:50:06PM +0100, Conrad Scott wrote:
> >
> >There's nothing explicitly in there (or SUSv3, which is what
> >using) but the page only mentions *using* it if the address
> >argument is not null.  Also, the code examples in Stevens's
> >Network Programming" for recvmsg(2) simply set the address
> >to null and leave the length pointer uninitialised, which would
> >make cygwin barf if it were also to check the address length
> >pointer.
> I don't have this reference.  How can a pointer be
> Do they do something like
> int *len;
> recvmsg(..., NULL, len);
> ?
> That sounds like bad programming to me, but if that is the
> then ok.

Sorry, I changed system call half-way through the explanation: I
agree w/ you: no-one should do what the obvious interpretation of
my comments would suggest :-)

What I meant to say was that the recvmsg(2) and sendmsg(2)
functions, which are just slightly generalised versions of the
sendto(2) and recvfrom(2) functions I was discussing, take a
msghdr struct that contains a `socklen_t *' and a `sockaddr *',
and in some of the code examples in the Stevens book, he simply
puts a NULL in the `sockaddr *' and leaves the `socklen_t *' to
fend for itself.

> Doh! Answering technical email with a splitting headache during
> meetings.  Always a sure way to embarrass myself.

Well, that makes two of us w/ headaches this afternoon.  Then
again, I was just posting out what I'd already written this
morning, so my disability wasn't so obvious.  Hope both your
headache and your meeting have passed away by now.

> I'm not 100% convinced about the len arguments but go ahead and
> this in and we can sort that out later.  I doubt that anyone
would ever
> complain about your changes ("Wah!  I wanted to get a ENOSYS by
> a bad length argument and you wouldn't let me!") so this is
really a
> non-issue.

I suspect I know what I'd be tempted to reply if someone did try
that . . .

> Hopefully Corinna won't mind since this is technically her code
> I think you've more than adequately explained things.

Perhaps I ought to leave it until tomorrow in that case, to give
Corinna a chance to savour the discussion and veto the patch if

Thanks for the feedback,

// Conrad

More information about the Cygwin-patches mailing list