mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-24 13:35:17 +00:00
storage: Set ret = -1 on failures in virStorageBackendUpdateVolTargetInfo
While processing the volume for lseek, virFileReadHeaderFD, and virStorageFileGetMetadataFromBuf - failure would cause an error, but ret would not be set. That would result in an error message being sent, but successful status being returned.
This commit is contained in:
parent
af4028dccd
commit
1edfce9b18
@ -1625,16 +1625,19 @@ virStorageBackendUpdateVolTargetInfo(virStorageSourcePtr target,
|
|||||||
|
|
||||||
if (lseek(fd, 0, SEEK_SET) == (off_t)-1) {
|
if (lseek(fd, 0, SEEK_SET) == (off_t)-1) {
|
||||||
virReportSystemError(errno, _("cannot seek to start of '%s'"), target->path);
|
virReportSystemError(errno, _("cannot seek to start of '%s'"), target->path);
|
||||||
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((len = virFileReadHeaderFD(fd, len, &buf)) < 0) {
|
if ((len = virFileReadHeaderFD(fd, len, &buf)) < 0) {
|
||||||
virReportSystemError(errno, _("cannot read header '%s'"), target->path);
|
virReportSystemError(errno, _("cannot read header '%s'"), target->path);
|
||||||
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(meta = virStorageFileGetMetadataFromBuf(target->path, buf, len, target->format,
|
if (!(meta = virStorageFileGetMetadataFromBuf(target->path, buf, len, target->format,
|
||||||
NULL))) {
|
NULL))) {
|
||||||
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user