From zach@gaffaneys.com  Fri Sep 11 07:00:58 1998
Received: from k6n1.znh.org (dialup2.gaffaneys.com [208.155.161.52])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA04454
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 11 Sep 1998 07:00:56 -0700 (PDT)
          (envelope-from zach@gaffaneys.com)
Received: (from zach@localhost)
	by k6n1.znh.org (8.9.1/8.9.1) id OAA09530;
	Fri, 11 Sep 1998 14:01:20 GMT
	(envelope-from zach)
Message-Id: <199809111401.OAA09530@k6n1.znh.org>
Date: Fri, 11 Sep 1998 14:01:20 GMT
From: Zach Heilig <zach@gaffaneys.com>
Reply-To: zach@gaffaneys.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: du -c gets totals wrong...
X-Send-Pr-Version: 3.2

>Number:         7896
>Category:       bin
>Synopsis:       du -c gets totals wrong
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    des
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 11 07:10:01 PDT 1998
>Closed-Date:    Fri Sep 11 08:55:02 PDT 1998
>Last-Modified:  Fri Sep 11 08:56:27 PDT 1998
>Originator:     Zach Heilig
>Release:        FreeBSD 3.0-CURRENT i386 (& FreeBSD 2.2.7-STABLE i386)
>Organization:
none
>Environment:

	

>Description:

du -c simply puts out the numbers in the last directory visited.

>How-To-Repeat:

[before fix:]
$ cd /usr/src/bin
$ du -c ed ls
4       ed/CVS
10      ed/test/CVS
165     ed/test
290     ed
4       ls/CVS
60      ls
60      total
$ 
[after fix:]
$ cd /usr/src/bin
$ du -c ed ls
4       ed/CVS
10      ed/test/CVS
165     ed/test
290     ed
4       ls/CVS
60      ls
350     total
$

>Fix:
Both -stable and -current need this fix:

Index: du.c
===================================================================
RCS file: /fs/ncvs/src/usr.bin/du/du.c,v
retrieving revision 1.12
diff -u -r1.12 du.c
--- du.c	1998/07/29 17:50:06	1.12
+++ du.c	1998/09/11 13:50:48
@@ -214,7 +214,7 @@
 
 				p->fts_parent->fts_number += p->fts_statp->st_blocks;
 		}
-		savednumber = p->fts_number;
+		savednumber = p->fts_parent->fts_number;
 	}
 
 	if (errno)
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->des 
Responsible-Changed-By: des 
Responsible-Changed-When: Fri Sep 11 08:40:28 PDT 1998 
Responsible-Changed-Why:  
I broke it, I'll fix it. 
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Fri Sep 11 08:55:02 PDT 1998 
State-Changed-Why:  
Patch tested and applied to -current and -stable. Thank you for bringing 
this matter to our attention. 
>Unformatted:
