socket-util: Correctly return negative values for errors.
authorBen Pfaff <blp@nicira.com>
Tue, 6 Dec 2011 23:55:22 +0000 (15:55 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 7 Dec 2011 16:37:22 +0000 (08:37 -0800)
commitb4adf44d1001c8690475efc617a325249a291bea
treeb860aca278607e654e7e607f47620261bcc3f783
parentb66df261bf0335eef09fde19dfe60faa7665cf65
socket-util: Correctly return negative values for errors.

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.

It really seems to me that this should have been found pretty quickly in
the field, since stream-tcp and stream-ssl both use inet_open_passive to
implement their passive listeners.  I'm surprised that no one has reported
it.
lib/socket-util.c