mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Don't reuse 'ret' variable in virStorageBackendProbeTarget
To match the convention: ret - current function's return value rc - other function's return values
This commit is contained in:
parent
e9f4729a01
commit
febcb89c5b
@ -69,6 +69,7 @@ virStorageBackendProbeTarget(virStorageSourcePtr target,
|
|||||||
{
|
{
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
int rc;
|
||||||
virStorageSourcePtr meta = NULL;
|
virStorageSourcePtr meta = NULL;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
@ -77,17 +78,13 @@ virStorageBackendProbeTarget(virStorageSourcePtr target,
|
|||||||
if (encryption)
|
if (encryption)
|
||||||
*encryption = NULL;
|
*encryption = NULL;
|
||||||
|
|
||||||
if ((ret = virStorageBackendVolOpen(target->path, &sb,
|
if ((rc = virStorageBackendVolOpen(target->path, &sb,
|
||||||
VIR_STORAGE_VOL_FS_PROBE_FLAGS)) < 0)
|
VIR_STORAGE_VOL_FS_PROBE_FLAGS)) < 0)
|
||||||
goto error; /* Take care to propagate ret, it is not always -1 */
|
return rc; /* Take care to propagate rc, it is not always -1 */
|
||||||
fd = ret;
|
fd = rc;
|
||||||
|
|
||||||
if ((ret = virStorageBackendUpdateVolTargetInfoFD(target, fd,
|
if (virStorageBackendUpdateVolTargetInfoFD(target, fd, &sb, true) < 0)
|
||||||
&sb, true)) < 0) {
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
|
||||||
|
|
||||||
ret = -1;
|
|
||||||
|
|
||||||
if (S_ISDIR(sb.st_mode)) {
|
if (S_ISDIR(sb.st_mode)) {
|
||||||
target->format = VIR_STORAGE_FILE_DIR;
|
target->format = VIR_STORAGE_FILE_DIR;
|
||||||
@ -104,10 +101,13 @@ virStorageBackendProbeTarget(virStorageSourcePtr target,
|
|||||||
|
|
||||||
VIR_FORCE_CLOSE(fd);
|
VIR_FORCE_CLOSE(fd);
|
||||||
|
|
||||||
|
/* Default to success below this point */
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
if (meta && *backingStore &&
|
if (meta && *backingStore &&
|
||||||
*backingStoreFormat == VIR_STORAGE_FILE_AUTO &&
|
*backingStoreFormat == VIR_STORAGE_FILE_AUTO &&
|
||||||
virStorageIsFile(*backingStore)) {
|
virStorageIsFile(*backingStore)) {
|
||||||
if ((ret = virStorageFileProbeFormat(*backingStore, -1, -1)) < 0) {
|
if ((rc = virStorageFileProbeFormat(*backingStore, -1, -1)) < 0) {
|
||||||
/* If the backing file is currently unavailable, only log an error,
|
/* If the backing file is currently unavailable, only log an error,
|
||||||
* but continue. Returning -1 here would disable the whole storage
|
* but continue. Returning -1 here would disable the whole storage
|
||||||
* pool, making it unavailable for even maintenance. */
|
* pool, making it unavailable for even maintenance. */
|
||||||
@ -116,11 +116,8 @@ virStorageBackendProbeTarget(virStorageSourcePtr target,
|
|||||||
*backingStore);
|
*backingStore);
|
||||||
ret = -3;
|
ret = -3;
|
||||||
} else {
|
} else {
|
||||||
*backingStoreFormat = ret;
|
*backingStoreFormat = rc;
|
||||||
ret = 0;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ret = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meta && meta->capacity)
|
if (meta && meta->capacity)
|
||||||
|
Loading…
Reference in New Issue
Block a user