Mailing List Archive

[xen-unstable] libxl: Clear file object on successful munmap()
# HG changeset patch
# User Signed-off-by: Jim Fehlig <jfehlig@novell.com>
# Date 1297972340 0
# Node ID 5a4710640f815db6609cc41f902752f28c1d06ab
# Parent 54b0749d9f4655508b1679de4bb2841c8a1aa512
libxl: Clear file object on successful munmap()

Clear members of libxl_file_reference when file is successfully unmapped.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
tools/libxl/libxl_internal.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)

diff -r 54b0749d9f46 -r 5a4710640f81 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c Thu Feb 17 19:50:44 2011 +0000
+++ b/tools/libxl/libxl_internal.c Thu Feb 17 19:52:20 2011 +0000
@@ -233,6 +233,12 @@ int libxl__file_reference_unmap(libxl_fi
return 0;

ret = munmap(f->data, f->size);
-
- return ret == 0 ? 0 : ERROR_FAIL;
-}
+ if (ret == 0) {
+ f->mapped = 0;
+ f->data = NULL;
+ f->size = 0;
+ return 0;
+ }
+
+ return ERROR_FAIL;
+}

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