diff --git a/src/util/virfile.c b/src/util/virfile.c index 81a3c096ebbf0df8cd455f961fd76a167a47194f..dbfe74e24f434a3e8aedf0c7ff90da880f5eea0d 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -781,6 +781,14 @@ int virFileLoopDeviceAssociate(const char *file, memset(&lo, 0, sizeof(lo)); lo.lo_flags = LO_FLAGS_AUTOCLEAR; + /* Set backing file name for LOOP_GET_STATUS64 queries */ + if (virStrncpy((char *) lo.lo_file_name, file, + strlen(file), LO_NAME_SIZE) < 0) { + virReportSystemError(errno, + _("Unable to set backing file %s"), file); + goto cleanup; + } + if ((fsfd = open(file, O_RDWR)) < 0) { virReportSystemError(errno, _("Unable to open %s"), file);