From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v4 2/3] libxl: localtime(3) can return NULL Date: Wed, 22 Jul 2015 16:13:34 +0100 Message-ID: <1437578014.19412.13.camel@citrix.com> References: <1437152468-20076-1-git-send-email-wei.liu2@citrix.com> <1437152468-20076-3-git-send-email-wei.liu2@citrix.com> <21929.13801.538158.774737@mariner.uk.xensource.com> <20150717171241.GW12455@zion.uk.xensource.com> <1437574748.19412.6.camel@citrix.com> <20150722150903.GC16933@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZHvin-0007dB-0N for xen-devel@lists.xenproject.org; Wed, 22 Jul 2015 15:14:13 +0000 In-Reply-To: <20150722150903.GC16933@zion.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: Xen-devel , Ian Jackson List-Id: xen-devel@lists.xenproject.org On Wed, 2015-07-22 at 16:09 +0100, Wei Liu wrote: > On Wed, Jul 22, 2015 at 03:19:08PM +0100, Ian Campbell wrote: > > On Fri, 2015-07-17 at 18:12 +0100, Wei Liu wrote: > > > On Fri, Jul 17, 2015 at 06:05:45PM +0100, Ian Jackson wrote: > > > > Wei Liu writes ("[PATCH v4 2/3] libxl: localtime(3) can return > > > > NULL"): > > > > > Signed-off-by: Wei Liu > > > > > > > > > tm = localtime(&t); > > > > > + if (!tm) { > > > > > + LOG(ERROR, "Failed to call localtime"); > > > > > > > > localtime sets errno if it fails. So you mean LOGE. > > > > > > > > > > Heh. Linux manpage doesn't say so. But > > > > > > http://pubs.opengroup.org/onlinepubs/009695399/functions/localtim > > > e.ht > > > ml > > > > > > does say that. > > > > > > I will rework this patch and send it out next week with other > > > coverity > > > scan inspired patches I accumulate. > > > > Should we not be using localtime_t in libxl? Afterall we don't know > > what other threads in the application might be doing. > > > > I guess you mean localtime_r. yes. > I agree with you we should use that one. > > Wei.