diff options
author | Ben Pfaff <blp@nicira.com> | 2009-12-11 16:59:44 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2009-12-11 16:59:44 -0800 |
commit | 21a60ea97b492ae642d5b35430b24d137cd67f35 (patch) | |
tree | 9b9e1207ce3f53975e21b89c97201bf535c457b9 /lib/socket-util.c | |
parent | fbd8fd40a33fa96060b4dffd911e04555f8771d4 (diff) |
socket-util: Clarify EAGAIN error code for make_unix_socket().
make_unix_socket() can return EAGAIN in rare circumstances, e.g. when the
server's socket listen queue is full. A lot of OVS callers interpret
EAGAIN as a "try again" error code, but in this case it means that the
attempt to create the socket failed. So munge EAGAIN into another error
code to prevent that misinterpretation.
Diffstat (limited to 'lib/socket-util.c')
-rw-r--r-- | lib/socket-util.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/socket-util.c b/lib/socket-util.c index e6a6c70e..ed190130 100644 --- a/lib/socket-util.c +++ b/lib/socket-util.c @@ -249,6 +249,7 @@ make_unix_socket(int style, bool nonblock, bool passcred UNUSED, make_sockaddr_un(connect_path, &un, &un_len); if (connect(fd, (struct sockaddr*) &un, un_len) && errno != EINPROGRESS) { + printf("connect failed with %s\n", strerror(errno)); goto error; } } @@ -265,10 +266,10 @@ make_unix_socket(int style, bool nonblock, bool passcred UNUSED, return fd; error: + error = errno == EAGAIN ? EPROTO : errno; if (bind_path) { fatal_signal_remove_file_to_unlink(bind_path); } - error = errno; close(fd); return -error; } |