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

[Xen-changelog] [xen-unstable] acm, xend: Follow linked files.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] acm, xend: Follow linked files.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 09 Nov 2007 04:20:09 -0800
Delivery-date: Fri, 09 Nov 2007 04:20:37 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1193909867 0
# Node ID ba1b6f9d33f58ab6064fe6a5d6eddf5ddfbed295
# Parent  76f30b65854fc69cab1f99182d7a4cf8eb20c9b8
acm, xend: Follow linked files.
Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
---
 tools/python/xen/util/xsm/acm/acm.py |   31 +++++++++++--------------------
 1 files changed, 11 insertions(+), 20 deletions(-)

diff -r 76f30b65854f -r ba1b6f9d33f5 tools/python/xen/util/xsm/acm/acm.py
--- a/tools/python/xen/util/xsm/acm/acm.py      Thu Nov 01 09:36:46 2007 +0000
+++ b/tools/python/xen/util/xsm/acm/acm.py      Thu Nov 01 09:37:47 2007 +0000
@@ -711,33 +711,24 @@ def unify_resname(resource, mustexist=Tr
         except:
             err("Resource spec '%s' contains no tap subtype" % resource)
 
-    import os
-    if typ in ["phy", "tap"]:
+    if typ in ["phy"]:
         if not resfile.startswith("/"):
             resfile = "/dev/" + resfile
         if mustexist:
-            stats = os.lstat(resfile)
-            if stat.S_ISLNK(stats[stat.ST_MODE]):
-                resolved = os.readlink(resfile)
-                if resolved[0] != "/":
-                    resfile = os.path.join(os.path.dirname(resfile), resolved)
-                    resfile = os.path.abspath(resfile)
-                else:
-                    resfile = resolved
+            resfile = os.path.realpath(resfile)
+            try:
                 stats = os.lstat(resfile)
-            if not (stat.S_ISBLK(stats[stat.ST_MODE])):
+                if not (stat.S_ISBLK(stats[stat.ST_MODE])):
+                    err("Invalid resource")
+            except:
                 err("Invalid resource")
 
     if typ in [ "file", "tap" ]:
-        if mustexist:
-            stats = os.lstat(resfile)
-            if stat.S_ISLNK(stats[stat.ST_MODE]):
-                resfile = os.readlink(resfile)
-                stats = os.lstat(resfile)
-            if not stat.S_ISREG(stats[stat.ST_MODE]):
-                err("Invalid resource")
-
-    #file: resources must specified with absolute path
+        resfile = os.path.realpath(resfile)
+        if mustexist and not os.path.isfile(resfile):
+            err("Invalid resource")
+
+    #file: resources must be specified with absolute path
     #vlan resources don't start with '/'
     if typ != "vlan":
         if (not resfile.startswith("/")) or \

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] acm, xend: Follow linked files., Xen patchbot-unstable <=