From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Smith Subject: [PATCH] Make 'xm save' sanity check the path Date: Mon, 26 Sep 2005 10:16:15 -0700 Message-ID: <87hdc7697k.fsf@us.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen Developers List-Id: xen-devel@lists.xenproject.org --=-=-= This patch adds a quick check in "xm save" to make sure the path given exists, and is writable. This will fix the issue detected by xm-test 03_save_bogusfile_neg. Signed-off-by: Dan Smith --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=save-checkwrite.patch diff -r 5ea81e640509 tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Sun Sep 25 10:47:22 2005 +++ b/tools/python/xen/xm/main.py Mon Sep 26 09:32:32 2005 @@ -175,6 +175,10 @@ dom = args[0] # TODO: should check if this exists savefile = os.path.abspath(args[1]) + + if not os.access(os.path.dirname(savefile), os.W_OK): + err("xm save: Unable to create file %s" % savefile) + sys.exit(1) from xen.xend.XendClient import server server.xend_domain_save(dom, savefile) --=-=-= -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-=-=--