Tiziano Mueller <dev-zero@gentoo.org>
Thibault VINCENT <thibault.vincent@smartjog.com>
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+ Jesse Cook <code.crashenx@gmail.com>
[....send patches to get your name here....]
}
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
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);