WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] xl: Add some return-code sanity checks to

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xl: Add some return-code sanity checks to 'xl info'.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 04 May 2010 13:20:33 -0700
Delivery-date: Tue, 04 May 2010 13:24:19 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1272970586 -3600
# Node ID df85c12d3c7f5773847e51cdcbf1de9558294527
# Parent  9f1e938261a40548c5403ed4ff92d2183e8d424d
xl: Add some return-code sanity checks to 'xl info'.

Signed-off-by: Yu Zhiguo <yuzg@xxxxxxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff -r 9f1e938261a4 -r df85c12d3c7f tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Tue May 04 11:49:46 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Tue May 04 11:56:26 2010 +0100
@@ -2640,7 +2640,11 @@ static void output_xeninfo(void)
     const libxl_version_info *info;
     int sched_id;
 
-    info = libxl_get_version_info(&ctx);
+    if (!(info = libxl_get_version_info(&ctx))) {
+        fprintf(stderr, "libxl_get_version_info failed.\n");
+        return;
+    }
+
     if ((sched_id = libxl_get_sched_id(&ctx)) < 0) {
         fprintf(stderr, "get_sched_id sysctl failed.\n");
         return;
@@ -2670,14 +2674,13 @@ static void output_nodeinfo(void)
 {
     struct utsname utsbuf;
 
-    uname(&utsbuf);
+    if (uname(&utsbuf) < 0)
+        return;
 
     printf("host                   : %s\n", utsbuf.nodename);
     printf("release                : %s\n", utsbuf.release);
     printf("version                : %s\n", utsbuf.version);
     printf("machine                : %s\n", utsbuf.machine);
-
-    return;
 }
 
 static void output_physinfo(void)
@@ -2706,9 +2709,11 @@ static void output_physinfo(void)
         printf(" hvm_directio");
     printf("\n");
     vinfo = libxl_get_version_info(&ctx);
-    i = (1 << 20) / vinfo->pagesize;
-    printf("total_memory           : %lu\n", info.total_pages / i);
-    printf("free_memory            : %lu\n", info.free_pages / i);
+    if (vinfo) {
+        i = (1 << 20) / vinfo->pagesize;
+        printf("total_memory           : %lu\n", info.total_pages / i);
+        printf("free_memory            : %lu\n", info.free_pages / i);
+    }
 
     return;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xl: Add some return-code sanity checks to 'xl info'., Xen patchbot-unstable <=