it's not necessary to limit the service name artificially to 8 characters

in inet*print() - only first 'width' characters of the 'host.service'
string would be printed anyway, so allow full service name if string would fit
This commit is contained in:
jdolecek 2003-03-22 15:18:36 +00:00
parent dd13dddfff
commit 842b4adcdc
2 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet.c,v 1.54 2003/02/04 01:22:08 thorpej Exp $ */
/* $NetBSD: inet.c,v 1.55 2003/03/22 15:18:36 jdolecek Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
__RCSID("$NetBSD: inet.c,v 1.54 2003/02/04 01:22:08 thorpej Exp $");
__RCSID("$NetBSD: inet.c,v 1.55 2003/03/22 15:18:36 jdolecek Exp $");
#endif
#endif /* not lint */
@ -583,7 +583,7 @@ inetprint(in, port, proto, numeric_port)
sp = getservbyport((int)port, proto);
space = sizeof line - (cp-line);
if (sp || port == 0)
(void)snprintf(cp, space, "%.8s", sp ? sp->s_name : "*");
(void)snprintf(cp, space, "%s", sp ? sp->s_name : "*");
else
(void)snprintf(cp, space, "%u", ntohs(port));
(void)printf(" %-*.*s", width, width, line);

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet6.c,v 1.25 2002/10/26 17:06:08 grant Exp $ */
/* $NetBSD: inet6.c,v 1.26 2003/03/22 15:18:36 jdolecek Exp $ */
/* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */
/*
@ -68,7 +68,7 @@
#if 0
static char sccsid[] = "@(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
__RCSID("$NetBSD: inet6.c,v 1.25 2002/10/26 17:06:08 grant Exp $");
__RCSID("$NetBSD: inet6.c,v 1.26 2003/03/22 15:18:36 jdolecek Exp $");
#endif
#endif /* not lint */
@ -1170,7 +1170,7 @@ do {\
GETSERVBYPORT6(port, proto, sp);
if (sp || port == 0)
snprintf(cp, sizeof(line) - (cp - line),
"%.8s", sp ? sp->s_name : "*");
"%s", sp ? sp->s_name : "*");
else
snprintf(cp, sizeof(line) - (cp - line),
"%d", ntohs((u_short)port));