Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Sep 1995 04:20:54 +0200 (MET DST)
From:      Ollivier Robert <roberto@keltia.Freenix.FR>
To:        jmacd@cory.EECS.Berkeley.EDU (Josh MacDonald)
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: 64 bit off_t and varargs/printf
Message-ID:  <199509170220.EAA01650@keltia.Freenix.FR>
In-Reply-To: <199509170122.SAA12369@cory.EECS.Berkeley.EDU> from "Josh MacDonald" at Sep 16, 95 06:22:06 pm

next in thread | previous in thread | raw e-mail | index | archive | help
It seems that Josh MacDonald said:
> 	char num[10];
> 	num = "1234"
> 	off_t size;
> 	size = strtoq(num, &num, 10);
> 	printf("%d\n", size);
> 
> is causing it troubles.  Replacing the off_t type with a long fixes
> things.  Anyone know what might be happening?

Yes,  you have the same bug  as did wu-ftpd. Put  %qd instead of  %d in the
printf format  string to fix  it. "%d" == int  (32 bits), "%qd" is quad (64
bits). 

-- 
Ollivier ROBERT    -=- The daemon is FREE! -=-    roberto@keltia.frmug.fr.net
 FreeBSD keltia.Freenix.FR 2.2-CURRENT #1: Sun Sep 10 18:50:19 MET DST 1995



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