提交 61c29fe5 编写于 作者: J John Ferlan

storage: Refactor virStorageBackendFileSystemGetPoolSource

Refactor code to use standard return functioning with respect to setting
a ret value and going to cleanup.
上级 1d1330f3
......@@ -418,6 +418,7 @@ virStorageBackendFileSystemGetPoolSource(virStoragePoolObjPtr pool)
static int
virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool)
{
int ret = -1;
FILE *mtab;
struct mntent ent;
char buf[1024];
......@@ -426,18 +427,21 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool)
virReportSystemError(errno,
_("cannot read mount list '%s'"),
_PATH_MOUNTED);
return -1;
goto cleanup;
}
while ((getmntent_r(mtab, &ent, buf, sizeof(buf))) != NULL) {
if (STREQ(ent.mnt_dir, pool->def->target.path)) {
VIR_FORCE_FCLOSE(mtab);
return 1;
ret = 1;
goto cleanup;
}
}
ret = 0;
cleanup:
VIR_FORCE_FCLOSE(mtab);
return 0;
return ret;
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册