From owner-freebsd-bugs@FreeBSD.ORG Mon Sep 13 15:46:19 2004 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A8E7F16A4CE; Mon, 13 Sep 2004 15:46:19 +0000 (GMT) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id 79F5543D4C; Mon, 13 Sep 2004 15:46:19 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.13.0/8.13.0) with ESMTP id i8DFkxBU021973; Mon, 13 Sep 2004 08:46:59 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.13.0/8.13.0/Submit) id i8DFkxox021972; Mon, 13 Sep 2004 08:46:59 -0700 Date: Mon, 13 Sep 2004 08:46:59 -0700 From: Brooks Davis To: Giorgos Keramidas Message-ID: <20040913154659.GB19644@odin.ac.hmc.edu> References: <200409130610.i8D6AQN2020172@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LpQ9ahxlCli8rRTG" Content-Disposition: inline In-Reply-To: <200409130610.i8D6AQN2020172@freefall.freebsd.org> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new X-Spam-Status: No, hits=0.0 required=8.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on odin.ac.hmc.edu cc: freebsd-bugs@freebsd.org Subject: Re: bin/71616: [PATCH] cleanup of the usr.sbin/yp_mkdb code X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Sep 2004 15:46:19 -0000 --LpQ9ahxlCli8rRTG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 13, 2004 at 06:10:26AM +0000, Giorgos Keramidas wrote: > The following reply was made to PR bin/71616; it has been noted by GNATS. >=20 > From: Giorgos Keramidas > To: Brooks Davis > Cc: bug-followup@freebsd.org > Subject: Re: bin/71616: [PATCH] cleanup of the usr.sbin/yp_mkdb code > Date: Mon, 13 Sep 2004 09:05:27 +0300 >=20 > On 2004-09-12 16:40, Brooks Davis wrote: > > On Sun, Sep 12, 2004 at 08:10:55PM +0000, Giorgos Keramidas wrote: > > > On 2004-09-12 04:37, Dan Lukes wrote: > > > > *** usr.sbin/yp_mkdb/yp_mkdb.c.ORIG Sun Sep 5 18:54:07 2004 > > > > --- usr.sbin/yp_mkdb/yp_mkdb.c Sun Sep 5 19:01:20 2004 > > > > [...] > > > > - snprintf(buf, sizeof(buf), "%lu", time(NULL)); > > > > + snprintf(buf, sizeof(buf), "%lu", (long unsigned int)time(NULL= )); > > > > > > Just a minor comment: An (unsigned long) cast should be fine here. > > > > Using unsigned here is actually bogus. time_t is a signed type > > in FreeBSD. SUSv3 says "time_t and clock_t shall be integer or > > real-floating types." In FreeBSD a cast an integer type is safe. > > > > Either long or intmax_t are decent choices today. > =20 > Hmmm, true. I had forgotten about negative values of time_t that repres= ent > dates before 1970. > =20 > Thanks :) SUS doesn't seem to require this, but in practice it's safe even if time_t is unsigned (the year 2.92E11 bug isn't something I'm going to worry about :-) and ours is signed. -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --LpQ9ahxlCli8rRTG Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFBRcDzXY6L6fI4GtQRAgG7AKDPcC8O88nrWb1lMOki/RRWRIR7/gCdHnvz gxqLvOl8mwSYFMwoeXwbDzA= =OE1w -----END PGP SIGNATURE----- --LpQ9ahxlCli8rRTG--