From 041dc07fd21b6987ffbcc6a597eb9918d44ae841 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 6 Dec 2011 15:57:15 -0800 Subject: [PATCH] socket-util: Don't try to listen to a UDP socket. The "listen" system call doesn't work and isn't necessary for UDP, but inet_open_passive() would still try to call it (and fail). This doesn't fix a real bug because the two existing callers both use inet_open_passive() to listen for TCP connections. Signed-off-by: Ben Pfaff --- lib/socket-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/socket-util.c b/lib/socket-util.c index 219433fb..12f04321 100644 --- a/lib/socket-util.c +++ b/lib/socket-util.c @@ -702,7 +702,7 @@ inet_open_passive(int style, const char *target, int default_port, } /* Listen. */ - if (listen(fd, 10) < 0) { + if (style == SOCK_STREAM && listen(fd, 10) < 0) { error = errno; VLOG_ERR("%s: listen: %s", target, strerror(error)); goto error; -- 2.30.2