Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Mar 2009 10:29:19 -0400
From:      Coleman Kane <cokane@FreeBSD.org>
To:        Poul-Henning Kamp <phk@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r189691 - head/sbin/recoverdisk
Message-ID:  <1236781759.1906.7.camel@localhost>
In-Reply-To: <1236781546.1906.5.camel@localhost>
References:  <200903111037.n2BAb2tj093282@svn.freebsd.org> <1236781546.1906.5.camel@localhost>

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

[-- Attachment #1 --]
On Wed, 2009-03-11 at 10:25 -0400, Coleman Kane wrote:
> On Wed, 2009-03-11 at 10:37 +0000, Poul-Henning Kamp wrote:
> > Author: phk
> > Date: Wed Mar 11 10:37:02 2009
> > New Revision: 189691
> > URL: http://svn.freebsd.org/changeset/base/189691
> > 
> > Log:
> >   Some improvements to recoverdisk
> > 
> > Modified:
> >   head/sbin/recoverdisk/recoverdisk.1
> >   head/sbin/recoverdisk/recoverdisk.c
> > 
> 
> < ... snip ... >
> 
> > 
> > Modified: head/sbin/recoverdisk/recoverdisk.c
> > ==============================================================================
> > --- head/sbin/recoverdisk/recoverdisk.c	Wed Mar 11 09:57:11 2009	(r189690)
> > +++ head/sbin/recoverdisk/recoverdisk.c	Wed Mar 11 10:37:02 2009	(r189691)
> 
> < ... snip ... >
> 
> > @@ -215,6 +213,17 @@ main(int argc, char * const argv[])
> >  		flags |= O_CREAT | O_TRUNC;
> >  	}
> >  
> > +	if (bigsize < minsize)
> > +		bigsize = minsize;
> > +
> > +	for (ch = 0; (bigsize >> ch) > minsize; ch++)
> > +		continue;
> > +	medsize = bigsize >> (ch / 2);
> > +	medsize = (medsize / minsize) * minsize;
> > +
> > +	fprintf(stderr, "Bigsize = %u, medsize = %u, minsize = %u\n",
> > +	    bigsize, medsize, minsize);
> > +
> >  	buf = malloc(bigsize);
> >  	if (buf == NULL)
> >  		err(1, "Cannot allocate %jd bytes buffer", (intmax_t)bigsize);
> >  
> 
> That new fprintf warns in the case where sizeof(size_t) !=
> sizeof(unsigned int), such as is the case on amd64.
> 

A quick read of the printf(3) page suggests

printf(stderr, "Bigsize = %zu, medsize = %zu, minsize = %zu\n", bigsize,
medsize, minsize);

is more appropriate... I think.

-- 
Coleman Kane

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEABECAAYFAkm3yr0ACgkQcMSxQcXat5fNFACggcThnC8APxejBk9WbtFRn6Jf
BzUAn0cLd+ZY0vmGMHWhGIJdLb/dQ3a1
=elo6
-----END PGP SIGNATURE-----

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