From owner-svn-src-all@FreeBSD.ORG Tue Aug 6 17:35:41 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DB293E3D; Tue, 6 Aug 2013 17:35:41 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B2A7C2B10; Tue, 6 Aug 2013 17:35:40 +0000 (UTC) Received: from alph.d.allbsd.org (p2049-ipbf1102funabasi.chiba.ocn.ne.jp [122.26.101.49]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id r76HZLQE076863 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 7 Aug 2013 02:35:31 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.d.allbsd.org (8.14.5/8.14.5) with ESMTP id r76HZJYA078690; Wed, 7 Aug 2013 02:35:21 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Wed, 07 Aug 2013 02:35:07 +0900 (JST) Message-Id: <20130807.023507.62577067127422432.hrs@allbsd.org> To: ian@FreeBSD.org Subject: Re: svn commit: r253995 - in head/usr.sbin: rtadvd rtsold From: Hiroki Sato In-Reply-To: <1375807689.3320.48.camel@revolution.hippie.lan> References: <201308061549.r76FnImt054058@svn.freebsd.org> <1375807689.3320.48.camel@revolution.hippie.lan> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Wed_Aug__7_02_35_07_2013_872)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Wed, 07 Aug 2013 02:35:31 +0900 (JST) X-Spam-Status: No, score=-90.5 required=13.0 tests=CONTENT_TYPE_PRESENT, DIRECTOCNDYN,DYN_PBL,RCVD_IN_PBL,SPF_SOFTFAIL,USER_IN_WHITELIST, X_CHINESE_RELAY autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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: Tue, 06 Aug 2013 17:35:41 -0000 ----Security_Multipart(Wed_Aug__7_02_35_07_2013_872)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Ian Lepore wrote in <1375807689.3320.48.camel@revolution.hippie.lan>: ia> On Tue, 2013-08-06 at 15:49 +0000, Hiroki Sato wrote: ia> > /* Generate maximum time in timespec. */ ia> > - memset(&tm_max.tv_sec, 0xff, sizeof(tm_max.tv_sec)); ia> > - memset(&tm_max.tv_nsec, 0xff, sizeof(tm_max.tv_nsec)); ia> > - tm_max.tv_sec &= ~(1UL << (sizeof(tm_max.tv_sec) * 8 - 1)); ia> > - tm_max.tv_nsec &= ~(1UL << (sizeof(tm_max.tv_nsec) * 8 - 1)); ia> > + tm_max.tv_sec = (-1) & ~((time_t)1 << ((sizeof(tm_max.tv_sec) * 8) - 1)); ia> > + tm_max.tv_nsec = (-1) & ~((long)1 << ((sizeof(tm_max.tv_nsec) * 8) - 1)); ia> > ia> > /* set log level */ ia> > if (dflag > 1) ia> ia> The maximum number of nsec is 999999999 regardless of the type of ia> tv_nsec. ia> ia> That expression for max time_t sure is ugly, but I can't think of ia> anything that isn't just differently-ugly. At least the comment makes ia> the purpose clear. This was defined as {0x7fffffff, 0x7fffffff} in the original code and used just as a large enough value to make a conditional (tm_max > tm_other) be always true, not the exact maximum value. Yes, this is ugly and can be improved. -- Hiroki ----Security_Multipart(Wed_Aug__7_02_35_07_2013_872)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (FreeBSD) iEYEABECAAYFAlIBM8sACgkQTyzT2CeTzy1HjwCgm7MxBuKwjGFoNeTDkxEzbAJZ mHgAmgM0ejxJFGsS8Wbd4EPfa4Omkeai =n77k -----END PGP SIGNATURE----- ----Security_Multipart(Wed_Aug__7_02_35_07_2013_872)----