svn commit: r189691 - head/sbin/recoverdisk

Coleman Kane cokane at FreeBSD.org
Wed Mar 11 07:30:47 PDT 2009


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20090311/8eea8096/attachment.pgp


More information about the svn-src-head mailing list