[ovs-dev] [PATCH] socket-util: Correctly return negative values for errors.
Ben Pfaff
blp at nicira.com
Wed Dec 7 15:22:00 UTC 2011
On Wed, Dec 07, 2011 at 09:19:41AM -0500, Brian Haley wrote:
> On 12/06/2011 06:55 PM, Ben Pfaff wrote:
> > The comment on this function says that negative values indicate errors, and
> > the callers assume that too, but in fact it was returning positive errno
> > values, which are indistinguishable from valid fd numbers.
>
> > @@ -716,6 +716,7 @@ inet_open_passive(int style, const char *target, int default_port,
> > goto error;
> > }
> > if (sin.sin_family != AF_INET || sin_len != sizeof sin) {
> > + error = EAFNOSUPPORT;
>
> -EAFNOSUPPORT, right?
No, the "error:" block at the end returns -error.
More information about the dev
mailing list