Skip to contentSkip to conversation

Make 'xm save' sanity check the path

PATCH Applied Dan Smith 2 participants 2 messages Sep 26, 2005 – Sep 27, 2005

lore
Share & tools
lore

Dan Smith

author
#0 lore raw

PATCH 1/1 Make 'xm save' sanity check the path

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.

tools/python/xen/xm/main.py +4 -0
diff -r 5ea81e640509 tools/python/xen/xm/main.py
@@ -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)
Signature · 4 lines
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: [email protected]

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Applied
#1 lore raw
Quoted 6 lines · Dan Smith

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.

Applied, thanks.

Ewan.