Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/rpc Don't try to listen on UDP sockets.



details:   https://anonhg.NetBSD.org/src/rev/3405548d22e8
branches:  trunk
changeset: 329571:3405548d22e8
user:      christos <christos%NetBSD.org@localhost>
date:      Thu May 29 12:35:45 2014 +0000

description:
Don't try to listen on UDP sockets.

diffstat:

 lib/libc/rpc/svc_generic.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r eaafb8cc431a -r 3405548d22e8 lib/libc/rpc/svc_generic.c
--- a/lib/libc/rpc/svc_generic.c        Thu May 29 10:47:23 2014 +0000
+++ b/lib/libc/rpc/svc_generic.c        Thu May 29 12:35:45 2014 +0000
@@ -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 @@
                                        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 @@
                                    __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;



Home | Main Index | Thread Index | Old Index