vconn: Report valid errno value if connection closed waiting for hello.
authorBen Pfaff <blp@nicira.com>
Fri, 12 Jun 2009 22:14:42 +0000 (15:14 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 12 Jun 2009 23:45:28 +0000 (16:45 -0700)
vconn_connect() is defined to return 0 on success or a positive errno
value on failure, but it was possible to get a negative value (EOF).  This
commit changes this to ECONNRESET to match caller expectations.

lib/vconn.c

index e4afb22..3c4efdb 100644 (file)
@@ -339,7 +339,7 @@ vcs_recv_hello(struct vconn *vconn)
 
     if (retval != EAGAIN) {
         vconn->state = VCS_DISCONNECTED;
-        vconn->error = retval;
+        vconn->error = retval == EOF ? ECONNRESET : retval;
     }
 }