svn commit: r226509 - head/bin/ls

Dag-Erling Smorgrav des at FreeBSD.org
Tue Oct 18 13:10:46 UTC 2011


Author: des
Date: Tue Oct 18 13:10:46 2011
New Revision: 226509
URL: http://svn.freebsd.org/changeset/base/226509

Log:
  When calculating the width of the blocksize column, ls(1) used 512-byte
  units (as returned by stat(2)) instead of BLOCKSIZE units.
  
  Submitted by:	Paul Schenkeveld
  MFC after:	3 weeks

Modified:
  head/bin/ls/ls.c

Modified: head/bin/ls/ls.c
==============================================================================
--- head/bin/ls/ls.c	Tue Oct 18 12:13:20 2011	(r226508)
+++ head/bin/ls/ls.c	Tue Oct 18 13:10:46 2011	(r226509)
@@ -44,7 +44,7 @@ static char sccsid[] = "@(#)ls.c	8.5 (Be
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include <sys/types.h>
+#include <sys/param.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <sys/mac.h>
@@ -835,7 +835,7 @@ label_out:
 	d.maxlen = maxlen;
 	if (needstats) {
 		d.btotal = btotal;
-		d.s_block = snprintf(NULL, 0, "%lu", maxblock);
+		d.s_block = snprintf(NULL, 0, "%lu", howmany(maxblock, blocksize));
 		d.s_flags = maxflags;
 		d.s_label = maxlabelstr;
 		d.s_group = maxgroup;


More information about the svn-src-head mailing list