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-devel

[Xen-devel] [PATCH] libxl: Clear file object on successful munmap()

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] libxl: Clear file object on successful munmap()
From: Jim Fehlig <jfehlig@xxxxxxxxxx>
Date: Thu, 17 Feb 2011 11:28:49 -0700
Delivery-date: Thu, 17 Feb 2011 10:30:03 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jim Fehlig <jfehlig@xxxxxxxxxx>
# Date 1297967281 25200
# Node ID a7061a9d0d92de5172afb42cbfdf2cd2d46d0d0e
# Parent  c0a46434347b265fc8c45e9be3adc41b43f4f682
libxl: Clear file object on successful munmap()

Clear members of libxl_file_reference when file is successfully unmapped.

    Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxxxx>

diff -r c0a46434347b -r a7061a9d0d92 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c      Wed Feb 16 18:23:48 2011 +0000
+++ b/tools/libxl/libxl_internal.c      Thu Feb 17 11:28:01 2011 -0700
@@ -233,6 +233,12 @@
                return 0;
 
        ret = munmap(f->data, f->size);
+       if (ret == 0) {
+               f->mapped = 0;
+               f->data = NULL;
+               f->size = 0;
+               return 0;
+       }
 
-       return ret == 0 ? 0 : ERROR_FAIL;
+       return ERROR_FAIL;
 }

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

<Prev in Thread] Current Thread [Next in Thread>