diff --git a/AUTHORS b/AUTHORS index 19abaf1158..821cd39616 100644 --- a/AUTHORS +++ b/AUTHORS @@ -164,6 +164,7 @@ Patches have also been contributed by: Tiziano Mueller Thibault VINCENT Naoya Horiguchi + Jesse Cook [....send patches to get your name here....] diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 9b7bcc46b6..8af2878bed 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -692,6 +692,8 @@ virStorageBackendCreateQemuImg(virConnectPtr conn, } if (vol->backingStore.path) { + int accessRetCode = -1; + char *absolutePath = NULL; /* XXX: Not strictly required: qemu-img has an option a different * backing store, not really sure what use it serves though, and it @@ -712,7 +714,20 @@ virStorageBackendCreateQemuImg(virConnectPtr conn, vol->backingStore.format); return -1; } - if (access(vol->backingStore.path, R_OK) != 0) { + + /* Convert relative backing store paths to absolute paths for access + * validation. + */ + if ('/' != *(vol->backingStore.path) && + virAsprintf(&absolutePath, "%s/%s", pool->def->target.path, + vol->backingStore.path) < 0) { + virReportOOMError(); + return -1; + } + accessRetCode = access(absolutePath ? absolutePath + : vol->backingStore.path, R_OK); + VIR_FREE(absolutePath); + if (accessRetCode != 0) { virReportSystemError(errno, _("inaccessible backing store volume %s"), vol->backingStore.path);