From owner-svn-src-all@FreeBSD.ORG Sun Dec 18 08:31:06 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE2E91065672; Sun, 18 Dec 2011 08:31:06 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3B9848FC0C; Sun, 18 Dec 2011 08:31:05 +0000 (UTC) Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pBI8V2C9014892 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 18 Dec 2011 19:31:04 +1100 Date: Sun, 18 Dec 2011 19:31:02 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Dimitry Andric In-Reply-To: <201112171352.pBHDqr9l061685@svn.freebsd.org> Message-ID: <20111218191653.X1495@besplex.bde.org> References: <201112171352.pBHDqr9l061685@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228626 - head/usr.bin/csup X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Dec 2011 08:31:06 -0000 On Sat, 17 Dec 2011, Dimitry Andric wrote: > Log: > In usr.bin/csup/proto.c, use the correct printf length modifier to print > an off_t. > ... > Modified: head/usr.bin/csup/proto.c > ============================================================================== > --- head/usr.bin/csup/proto.c Sat Dec 17 13:14:44 2011 (r228625) > +++ head/usr.bin/csup/proto.c Sat Dec 17 13:52:53 2011 (r228626) > ... > @@ -751,7 +752,7 @@ proto_printf(struct stream *wr, const ch > break; > case 'O': > off = va_arg(ap, off_t); > - rv = stream_printf(wr, "%llu", off); > + rv = stream_printf(wr, "%" PRId64, off); > break; > case 'S': > s = va_arg(ap, char *); PRId64 is another incorrect printf format. off_t is typedefed so that it can be changed as neccessary. Using PRId64 hard-codes the assumption that it is precisely a 64 bit signed integer. It is indeed a signed integer (POSIX 2001 standard). In 1990 POSIX, it was only required to be a signed arithmetic type, so portable code had to handle the possibility that it was floating point, and on systems with C90 compilers and 32-bit longs, it needed to be floating point for it represent values a bit larger than 2**31-1. In FreeBSD-1, it was 32 bits, so neither of the above would compile. In FreeBSD[2-10], it is 64 bits integral. FreeBSD depended on using a non-C90 compiler even to declare it, and never needed floating point for it, except for strict C90 support it would have needed a compat layer with the int64_t kernel off_t trranslated to a long double userland off_t. Bruce