aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_private.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-06-21 09:55:12 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-06-21 09:55:12 +0100
commitff4cc394909125814f2a1e2e8e592b105f5ffc44 (patch)
treea6f7722ab19527802b31f13f876e1ae7fab24c90 /tools/libxc/xc_private.c
parent636fed5063dc8a5d0c64bb15bfa13616304415bd (diff)
downloadxen-ff4cc394909125814f2a1e2e8e592b105f5ffc44.tar.gz
xen-ff4cc394909125814f2a1e2e8e592b105f5ffc44.tar.bz2
xen-ff4cc394909125814f2a1e2e8e592b105f5ffc44.zip
libxc: Fix Segmentation fault of xend
If /proc/xen/privcmd cannot be opened, start xend occurs Segmentation fault. Add check to fix it. Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>
Diffstat (limited to 'tools/libxc/xc_private.c')
-rw-r--r--tools/libxc/xc_private.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index 9761b98af4..13a990a58c 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -82,8 +82,10 @@ const xc_error *xc_get_last_error(xc_interface *xch)
void xc_clear_last_error(xc_interface *xch)
{
- xch->last_error.code = XC_ERROR_NONE;
- xch->last_error.message[0] = '\0';
+ if (xch) {
+ xch->last_error.code = XC_ERROR_NONE;
+ xch->last_error.message[0] = '\0';
+ }
}
const char *xc_error_code_to_desc(int code)