]> xenbits.xensource.com Git - xen.git/commitdiff
Fix blktap script for versions of readlink command that do not handle
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 31 Aug 2007 10:10:21 +0000 (11:10 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Fri, 31 Aug 2007 10:10:21 +0000 (11:10 +0100)
regular files.
Signed-off-by: Ben Guthro <bguthro@virtualiron.com>
Signed-off-by: Josh Nicholas <jnicholas@virtualiron.com>
tools/examples/blktap

index e4ac40b33164ef918097623c67e5e2ce5969fae4..b3a0b63544bd1d679dd735ddb7e82225d79fbfff 100644 (file)
@@ -69,7 +69,13 @@ then
         p=${p#*:}
     fi
 fi
-file=$(readlink -f "$p") || ebusy "$p does not exist."
+# some versions of readlink cannot be passed a regular file
+if [ -L "$p" ]; then
+    file=$(readlink -f "$p") || ebusy "$p link does not exist."
+else
+    [ -f "$p" ] || { ebusy "$p file does not exist." }
+    file="$p"
+fi
 
 if [ "$mode" != '!' ] 
 then