From a5b4ac3b081393a1229f6f31ce6c082beb0c2f11 Mon Sep 17 00:00:00 2001 From: Andy Grover Date: Tue, 28 Apr 2015 12:23:09 -0700 Subject: Always use realpath when creating file storage objects Let there be no doubt the path to the open backing file or block device. Signed-off-by: Andy Grover --- rtslib/tcm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'rtslib') diff --git a/rtslib/tcm.py b/rtslib/tcm.py index 4d869f7..43b412e 100644 --- a/rtslib/tcm.py +++ b/rtslib/tcm.py @@ -564,9 +564,10 @@ class FileIOStorageObject(StorageObject): def _configure(self, dev, size, wwn, write_back): self._check_self() + dev = os.path.realpath(dev) block_type = get_blockdev_type(dev) if block_type is None: # a file - if os.path.exists(os.path.realpath(dev)) and not os.path.isfile(dev): + if os.path.exists(dev) and not os.path.isfile(dev): raise RTSLibError("Path not to a file or block device") if size is None: -- cgit v1.2.1