kvm tools: check read permission before using the root partition of the host to boot VM

The commit fbe8d0f (kvm tools: Use the root partition of the host to boot the
guest machine) changed the default image for virtual machine to root partition
of the host machine. The patch adds a check to ensure appropriate permission
(a read permission) is available for kvm tool to use this partition.

Signed-off-by: Prasad Joshi <prasadjoshi124@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
This commit is contained in:
Prasad Joshi
2015-06-01 16:39:42 +01:00
committed by Will Deacon
parent ca99b3d340
commit afa0f6c1c6
+4
View File
@@ -264,6 +264,10 @@ static int root_device(char *dev, long *part)
/* verify the device path */
if (stat(dev, &st) < 0)
return -1;
if (access(dev, R_OK) < 0)
return -1;
return 0;
}