static int
virHookCheck(int no, const char *driver)
{
- char *path;
- int ret;
+ VIR_AUTOFREE(char *) path = NULL;
if (driver == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
}
if (!virFileExists(path)) {
- ret = 0;
VIR_DEBUG("No hook script %s", path);
- } else if (!virFileIsExecutable(path)) {
- ret = 0;
+ return 0;
+ }
+
+ if (!virFileIsExecutable(path)) {
VIR_WARN("Non-executable hook script %s", path);
- } else {
- ret = 1;
- VIR_DEBUG("Found hook script %s", path);
+ return 0;
}
- VIR_FREE(path);
- return ret;
+ VIR_DEBUG("Found hook script %s", path);
+ return 1;
}
/*
char **output)
{
int ret;
- char *path;
+ VIR_AUTOFREE(char *) path = NULL;
virCommandPtr cmd;
const char *drvstr;
const char *opstr;
virCommandFree(cmd);
- VIR_FREE(path);
-
return ret;
}