From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: [PATCH v4 2/3] libxl: localtime(3) can return NULL Date: Fri, 17 Jul 2015 18:01:07 +0100 Message-ID: <1437152468-20076-3-git-send-email-wei.liu2@citrix.com> References: <1437152468-20076-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZG916-0001Ds-Ub for xen-devel@lists.xenproject.org; Fri, 17 Jul 2015 17:01:45 +0000 In-Reply-To: <1437152468-20076-1-git-send-email-wei.liu2@citrix.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: Xen-devel Cc: Wei Liu , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org Signed-off-by: Wei Liu --- v4: add logging --- tools/libxl/libxl_x86.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/libxl/libxl_x86.c b/tools/libxl/libxl_x86.c index 8cd15ca..ce14a73 100644 --- a/tools/libxl/libxl_x86.c +++ b/tools/libxl/libxl_x86.c @@ -311,6 +311,12 @@ int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config, t = time(NULL); tm = localtime(&t); + if (!tm) { + LOG(ERROR, "Failed to call localtime"); + ret = ERROR_FAIL; + goto out; + } + rtc_timeoffset += tm->tm_gmtoff; } @@ -335,6 +341,7 @@ int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config, } } +out: return ret; } -- 1.9.1