From ba83eae40fc7f12db19e94ca810773c3eb5deb84 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 23 Mar 2007 09:18:24 +0000 Subject: [PATCH] * src/xen_internal.c: Fix detection of host PAE capabilities, nul-terminate the token in the output XML and a couple of cleanups for determining structure sizes. --- ChangeLog | 6 ++++++ src/xen_internal.c | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f7c3c015c..86f204ec26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Mar 23 09:12:00 UTC 2007 Richard W.M. Jones + + * src/xen_internal.c: Fix detection of host PAE capabilities, + nul-terminate the token in the output XML and a couple of + cleanups for determining structure sizes. + Thu Mar 22 19:38:38 CET 2007 Daniel Veillard * qemud/iptables.c qemud/qemud.c src/conf.c src/hash.c src/libvirt.c diff --git a/src/xen_internal.c b/src/xen_internal.c index 66066de6e2..5c4a0e7fb4 100644 --- a/src/xen_internal.c +++ b/src/xen_internal.c @@ -1523,7 +1523,7 @@ xenHypervisorGetCapabilities (virConnectPtr conn) strncpy (hvm_type, &line[subs[1].rm_so], subs[1].rm_eo-subs[1].rm_so+1); hvm_type[subs[1].rm_eo-subs[1].rm_so] = '\0'; - } else if (regexec (&flags_hvm_rec, line, 0, NULL, 0) == 0) + } else if (regexec (&flags_pae_rec, line, 0, NULL, 0) == 0) host_pae = 1; } @@ -1573,10 +1573,12 @@ xenHypervisorGetCapabilities (virConnectPtr conn) * this buffer. Parse out the features from each token. */ for (str = line, nr_guest_archs = 0; - nr_guest_archs < (sizeof(guest_archs)/sizeof(struct guest_arch)) + nr_guest_archs < sizeof guest_archs / sizeof guest_archs[0] && (token = strtok_r (str, " ", &saveptr)) != NULL; str = NULL) { - if (regexec (&xen_cap_rec, token, (sizeof(subs)/sizeof(regmatch_t)), subs, 0) == 0) { + if (regexec (&xen_cap_rec, token, sizeof subs / sizeof subs[0], + subs, 0) == 0) { + token[subs[0].rm_eo] = '\0'; guest_archs[nr_guest_archs].token = token; guest_archs[nr_guest_archs].hvm = strncmp (&token[subs[1].rm_so], "hvm", 3) == 0;