summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2015-04-17 06:33:30 +0000
committerguenther <guenther@openbsd.org>2015-04-17 06:33:30 +0000
commitdceb0fda27bd836a3de73157e4b7fcdf08dd6878 (patch)
tree0f120e401645479d34c401a2b8d1a0ed6f52bcf1
parentThe first argument to socket/socketpair is an address family, not a protocol (diff)
downloadwireguard-openbsd-dceb0fda27bd836a3de73157e4b7fcdf08dd6878.tar.xz
wireguard-openbsd-dceb0fda27bd836a3de73157e4b7fcdf08dd6878.zip
oops, started expecting sockoptlevelname() to handle two arguments
but never actually did so. Fix that so that we stop losing the second argument to {get,set}sockopt(). Handling of levels other than SOL_SOCKET could be improved.
-rw-r--r--usr.bin/kdump/kdump.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index a926f366be7..45ebeeadde0 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kdump.c,v 1.99 2015/04/17 06:14:36 guenther Exp $ */
+/* $OpenBSD: kdump.c,v 1.100 2015/04/17 06:33:30 guenther Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -56,6 +56,7 @@
#include <err.h>
#include <fcntl.h>
#include <limits.h>
+#include <netdb.h>
#include <poll.h>
#include <signal.h>
#include <stdio.h>
@@ -1632,16 +1633,21 @@ clockname(int clockid)
/*
* [g|s]etsockopt's level argument can either be SOL_SOCKET or a value
- * referring to a line in /etc/protocols . It might be appropriate
- * to use getprotoent(3) here.
+ * referring to a line in /etc/protocols.
*/
static void
-sockoptlevelname(int level)
+sockoptlevelname(int optname)
{
- if (level == SOL_SOCKET)
- (void)printf("SOL_SOCKET");
- else
- pdecint(level);
+ struct protoent *pe;
+
+ if (arg1 == SOL_SOCKET) {
+ (void)printf("SOL_SOCKET,");
+ sockoptname(optname);
+ } else {
+ pe = getprotobynumber(arg1);
+ (void)printf("%u<%s>,%d", arg1,
+ pe != NULL ? pe->p_name : "unknown", optname);
+ }
}
static void