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:49 +0000 (08:37 -0800)
commit2a71b8db7d120fbf22aa8f39c64a6fed1f5188ed
treefedce466f886189a16378718e279cc132e13ea10
parent65038bdcb2450307b72a57afe32914098e7ab12b
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