aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-03-25 07:41:55 +0000
committerKeir Fraser <keir.fraser@citrix.com>2010-03-25 07:41:55 +0000
commit8c2f103b2230456ffc00497d9b74f5725e28afe9 (patch)
treea9517e44fcafb94bdf79d05647ee50c4fe7ebf70
parent6e4406161b1dd35f57dd11817118562e26205cb6 (diff)
downloadxen-8c2f103b2230456ffc00497d9b74f5725e28afe9.tar.gz
xen-8c2f103b2230456ffc00497d9b74f5725e28afe9.tar.bz2
xen-8c2f103b2230456ffc00497d9b74f5725e28afe9.zip
Fix gdbserver-xen support on older kernels.
The xc_ptrace API relies on errno for passing success/failure indication back to callers. However, mapping operations that fall back on legacy APIs may leave errno set to a non-zero result even thought the operation is successful. This patch resets errno after successful map operations so that xc_ptrace doesn't inadvertently return a failure. Signed-off-by: Justin Gibbs <gibbs@scsiguy.com>
-rw-r--r--tools/libxc/xc_ptrace.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/libxc/xc_ptrace.c b/tools/libxc/xc_ptrace.c
index 725a022339..e91ac56da6 100644
--- a/tools/libxc/xc_ptrace.c
+++ b/tools/libxc/xc_ptrace.c
@@ -193,6 +193,13 @@ map_domain_va(
if (map == NULL)
return NULL;
+ /*
+ * Due to the use of API fallback code in libxc, errno may
+ * be clobberred during successful operations. Since the caller
+ * of xc_ptrace is depending on errno for return status, clear
+ * errno here.
+ */
+ errno = 0;
return map + (va & ~PAGE_MASK);
}