Skip to contentSkip to conversation

Make 'xm restore' 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 restore' sanity check the path

This patch adds a quick check to 'xm restore' that checks the existence and readability of the file given.

This fixes the issue detected in xm-tests 03_restore_badparm_neg and 04_restore_badfilename_neg.

tools/python/xen/xm/main.py +4 -0
diff -r 5ea81e640509 tools/python/xen/xm/main.py
@@ -183,6 +187,10 @@
     arg_check(args,1,"restore")
 
     savefile = os.path.abspath(args[0])
+
+    if not os.access(savefile, os.R_OK):
+        err("xm restore: Unable to read file %s" % savefile)
+        sys.exit(1)
 
     from xen.xend.XendClient import server
     info = server.xend_domain_restore(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 7 lines · Dan Smith

This patch adds a quick check to 'xm restore' that checks the existence and readability of the file given.

This fixes the issue detected in xm-tests 03_restore_badparm_neg and 04_restore_badfilename_neg.

Applied, thank you.

Ewan.