misc/156768: sockstat: missing spaces between long fields in output

Alexandr alter at alter.org.ua
Mon May 2 16:00:19 UTC 2011


>Number:         156768
>Category:       misc
>Synopsis:       sockstat: missing spaces between long fields in output
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 02 16:00:19 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Alexandr
>Release:        7.2 RELEASE-p8
>Organization:
NetAssist
>Environment:
FreeBSD homecat.alter.org.ua 7.2-RELEASE-p8 FreeBSD 7.2-RELEASE-p8 #6: Sat Apr 23 12:52:20 EEST 2011     root at homecat.alter.org.ua:/usr/src/sys/i386/compile/CAT_v14c  i386

>Description:
FD field is too narrow. Space between columns may be missing if we have too large value.
>How-To-Repeat:

>Fix:
http://alter.org.ua/soft/fbsd/sockstat/fbsd72.sockstat.20110501.patch.gz

Patch attached with submission follows:

diff -crN orig/usr.bin/sockstat/sockstat.c new/usr.bin/sockstat/sockstat.c
*** orig/usr.bin/sockstat/sockstat.c	Wed Apr 20 10:38:46 2011
--- new/usr.bin/sockstat/sockstat.c	Wed Apr 20 10:38:46 2011
***************
*** 587,610 ****
  			pos += xprintf("%lu", (u_long)xf->xf_uid);
  		else
  			pos += xprintf("%s", pwd->pw_name);
! 		while (pos < 9)
  			pos += xprintf(" ");
! 		pos += xprintf("%.10s", getprocname(xf->xf_pid));
! 		while (pos < 20)
  			pos += xprintf(" ");
! 		pos += xprintf("%lu", (u_long)xf->xf_pid);
! 		while (pos < 26)
  			pos += xprintf(" ");
! 		pos += xprintf("%d", xf->xf_fd);
! 		while (pos < 33)
  			pos += xprintf(" ");
! 		pos += xprintf("%s", s->protoname);
  		if (s->vflag & INP_IPV4)
  			pos += xprintf("4");
  		if (s->vflag & INP_IPV6)
  			pos += xprintf("6");
! 		while (pos < 40)
  			pos += xprintf(" ");
  		switch (s->family) {
  		case AF_INET:
  		case AF_INET6:
--- 587,611 ----
  			pos += xprintf("%lu", (u_long)xf->xf_uid);
  		else
  			pos += xprintf("%s", pwd->pw_name);
! 		while (pos < 8)
  			pos += xprintf(" ");
! 		pos += xprintf(" %.10s", getprocname(xf->xf_pid));
! 		while (pos < 19)
  			pos += xprintf(" ");
! 		pos += xprintf(" %lu", (u_long)xf->xf_pid);
! 		while (pos < 25)
  			pos += xprintf(" ");
! 		pos += xprintf(" %d", xf->xf_fd);
! 		while (pos < 32)
  			pos += xprintf(" ");
! 		pos += xprintf(" %s", s->protoname);
  		if (s->vflag & INP_IPV4)
  			pos += xprintf("4");
  		if (s->vflag & INP_IPV6)
  			pos += xprintf("6");
! 		while (pos < 39)
  			pos += xprintf(" ");
+ 		pos += xprintf(" ");
  		switch (s->family) {
  		case AF_INET:
  		case AF_INET6:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list