Don't try to listen on UDP sockets.

This commit is contained in:
christos 2014-05-29 12:35:45 +00:00
parent c45e6d878d
commit f75f663858

View File

@ -1,4 +1,4 @@
/* $NetBSD: svc_generic.c,v 1.16 2014/05/28 14:49:28 christos Exp $ */
/* $NetBSD: svc_generic.c,v 1.17 2014/05/29 12:35:45 christos Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)svc_generic.c 1.21 89/02/28 Copyr 1988 Sun Micro";
#else
__RCSID("$NetBSD: svc_generic.c,v 1.16 2014/05/28 14:49:28 christos Exp $");
__RCSID("$NetBSD: svc_generic.c,v 1.17 2014/05/29 12:35:45 christos Exp $");
#endif
#endif
@ -251,7 +251,8 @@ svc_tli_create(
goto freedata;
}
}
if (listen(fd, SOMAXCONN) == -1) {
if (si.si_socktype != SOCK_DGRAM &&
listen(fd, SOMAXCONN) == -1) {
warnx("%s: could not listen at anonymous port",
__func__);
goto freedata;
@ -264,7 +265,8 @@ svc_tli_create(
__func__);
goto freedata;
}
if (listen(fd, (int)bindaddr->qlen) == -1) {
if (si.si_socktype != SOCK_DGRAM &&
listen(fd, (int)bindaddr->qlen) == -1) {
warnx("%s: could not listen at requested "
"address", __func__);
goto freedata;