Subject: Re: Antw: Re: Select (function _libssh2_wait_socket) issue on some on an embedded platform

Re: Antw: Re: Select (function _libssh2_wait_socket) issue on some on an embedded platform

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 26 Mar 2010 14:43:13 +0100 (CET)

On Fri, 26 Mar 2010, Sebastien Fricker wrote:

Please don't top-post, it makes it very hard to follow the discussion.

> On RTOS select always return 0 if readfd and writefd are pointing to
> the same variable.

That is crazy behavior and you don't need to explain it to us here, I want it
explained with a comment in the patch!

> if you have a look on the prototype of the select function you can see that
> the df_set pointer are not const pointers:

Yes, but that only mean that we cannot use the contents of the variables for
anything sensible, and if you read the code you'll see that we don't.

> I guess that this is the problem: &fd is modified twice, and this could be a
> problem on some OS.

Only in bad implementations, but I already explained that I'm fine with
adapting to them. I would argue that a select() implementation should have the
values stored in variables of its own and copy those values to the
out-parameters (instead of assuming that the pointers point to two different
areas), as then it would work perfectly fine even when apps do what we do.
Given that we know this code works on quite a few platforms, I would assume
most select()-implmentations work that way.

If I were you, I'd file a bug report to the OS manufacturer.

-- 
  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-03-26