From owner-freebsd-current@FreeBSD.ORG Sun Aug 6 10:16:03 2006 Return-Path: X-Original-To: current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4ABA716A4DD; Sun, 6 Aug 2006 10:16:03 +0000 (UTC) (envelope-from rse@engelschall.com) Received: from visp1.engelschall.com (visp1.engelschall.com [195.30.6.144]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4FFF143D5A; Sun, 6 Aug 2006 10:16:02 +0000 (GMT) (envelope-from rse@engelschall.com) Received: by visp1.engelschall.com (Postfix, from userid 21100) id CFA6D1B4482E; Sun, 6 Aug 2006 12:16:00 +0200 (CEST) Received: by en1.engelschall.com (Postfix, from userid 10000) id 7CC53A1B02; Sun, 6 Aug 2006 12:15:17 +0200 (CEST) Date: Sun, 6 Aug 2006 12:15:17 +0200 From: "Ralf S. Engelschall" To: Dmitry Morozovsky Message-ID: <20060806101517.GA37482@engelschall.com> References: <20060805155548.EBE837302F@freebsd-current.sentex.ca> <20060805220746.U9314@woozle.rinet.ru> <20060805223658.X9314@woozle.rinet.ru> <20060806082927.GA17297@engelschall.com> <20060806133029.N36363@woozle.rinet.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060806133029.N36363@woozle.rinet.ru> Organization: FreeBSD User-Agent: Mutt/1.5.12 OpenPKG/CURRENT-2006-07-14 X-Mailman-Approved-At: Sun, 06 Aug 2006 14:47:24 +0000 Cc: Subject: Re: [head tinderbox] failure on amd64/amd64 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "Ralf S. Engelschall" List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Aug 2006 10:16:03 -0000 On Sun, Aug 06, 2006, Dmitry Morozovsky wrote: > On Sun, 6 Aug 2006, Ralf S. Engelschall wrote: > > RSE> > DM> It seems at least on amd64 size_t (strlen() result) is not int. > RSE> > > RSE> > Or, maybe, the following would be less ugly: > > RSE> > tdone_str = ctime(&tdone); > RSE> > + tdone_str[(strlen(tdone_str) - 1)] = '\0'; > > Well, next thought: ctime(3) described as POSIX.1 function having fixed length > of 26 chars. Is it safe and standards-compliant to save strlen(3) call and just > use tdone_str[24] = '\0' ? This was my first thought also after reading the ctime(3) manual page. But after quickly checking the sources it didn't looked to me that the string is always really exactly 26 characters only. I think the strlen(3) call is acceptable as this way we are really doing what we want: we strip the trailing newline. If we hard-code a "26" here we would just obfuscate the source even more as the reader certainly doesn't understand at the first spot from where the magic "26" comes from. Ralf S. Engelschall rse@engelschall.com www.engelschall.com