Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Mar 2010 07:41:13 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Giovanni Trematerra <giovanni.trematerra@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Randall Stewart <rrs@lakerest.net>, Bruce Cran <brucec@freebsd.org>
Subject:   Re: svn commit: r205119 - head/contrib/top
Message-ID:  <20100331072023.E2216@besplex.bde.org>
In-Reply-To: <4e6cba831003300839u5eac26d2n142ecb69502a64b0@mail.gmail.com>
References:  <201003131117.o2DBHek2003410@svn.freebsd.org> <4e6cba831003300839u5eac26d2n142ecb69502a64b0@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Tue, 30 Mar 2010, Giovanni Trematerra wrote:

> On Sat, Mar 13, 2010 at 1:17 PM, Bruce Cran <brucec@freebsd.org> wrote:
>> Author: brucec
>> Date: Sat Mar 13 11:17:39 2010
>> New Revision: 205119
>> URL: http://svn.freebsd.org/changeset/base/205119
>>
>> Log:
>>  Change the 'amt' parameter in format_k2 from int to unsigned long long
>>  to match the values passed in and prevent the SIZE field being corrupted
>>  when more than 2TB is allocated.
>>
>>  PR:           bin/129706
>>  Approved by:  rrs (mentor)
>>  MFC after:    1 week

Grrr, where are the ASCII ribbon campaigners?

mav@ (?) just reported a type error in this.  I may have already complained
about this :-).  unsigned long long should be a syntax error...

>>
>> Modified:
>>  head/contrib/top/utils.c
>>
>> Modified: head/contrib/top/utils.c
>> ==============================================================================
>> --- head/contrib/top/utils.c    Sat Mar 13 11:08:57 2010        (r205118)
>> +++ head/contrib/top/utils.c    Sat Mar 13 11:17:39 2010        (r205119)
>> @@ -476,7 +476,7 @@ int amt;
>>
>>  char *format_k2(amt)
>>
>> -int amt;
>> +unsigned long long amt;
>>
>>  {
>>     static char retarray[NUM_STRINGS][16];
>
> While here wouldn't be good thing to ansify the function?

No, ansi doesn't exist, and this is contribed code which is already
hundreds if not thousands of versions behind the "vendor" version,
partly because even non-gratuitous changes in it are hard to maintain.
contrib/top doesn't have many local changes, but usr.bin/top does
(including an almost complete reformatting to KNF), and unfortunately
the "vendor" changed almost everything in that too.

format_k2() is a FreeBSD addition.  In the "vendor" version 3.8b1, there
is still only format_k().  This has been converted to a new-style definition
so that it can no longer be compiled by old compilers, and its parameter
type has been changed from int to long, which is hopefully long enough.
Even its style has been improved.

Bruce

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100331072023.E2216>