From dceb0fda27bd836a3de73157e4b7fcdf08dd6878 Mon Sep 17 00:00:00 2001 From: guenther Date: Fri, 17 Apr 2015 06:33:30 +0000 Subject: [PATCH] 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. --- usr.bin/kdump/kdump.c | 22 ++++++++++++++-------- 1 file 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 #include #include +#include #include #include #include @@ -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 -- 2.20.1