X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fvconn-unix.c;h=baa9861f6fd08fd750e3e755d8283b64018ff17b;hb=f7ef6533d8e48565f21a67021e8477b6f5a59ae3;hp=aec2e31d630cbb4b1e956cbd0059580a2eea1d4d;hpb=a14bc59fb8f27db193d74662dc9c5cb8237177ef;p=openvswitch diff --git a/lib/vconn-unix.c b/lib/vconn-unix.c index aec2e31d..baa9861f 100644 --- a/lib/vconn-unix.c +++ b/lib/vconn-unix.c @@ -81,7 +81,7 @@ static int punix_accept(int fd, const struct sockaddr *sa, size_t sa_len, static int punix_open(const char *name UNUSED, char *suffix, struct pvconn **pvconnp) { - int fd; + int fd, error; fd = make_unix_socket(SOCK_STREAM, true, true, suffix, NULL); if (fd < 0) { @@ -89,6 +89,19 @@ punix_open(const char *name UNUSED, char *suffix, struct pvconn **pvconnp) return errno; } + error = set_nonblocking(fd); + if (error) { + close(fd); + return error; + } + + if (listen(fd, 10) < 0) { + error = errno; + VLOG_ERR("%s: listen: %s", name, strerror(error)); + close(fd); + return error; + } + return new_pstream_pvconn("punix", fd, punix_accept, pvconnp); }