qemu: refactor qemuCompressProgramAvailable()

This commit is contained in:
Peter Krempa 2013-10-09 18:05:13 +02:00
parent f2b0a5336e
commit a863b89010

View File

@ -3138,18 +3138,18 @@ cleanup:
} }
/* Returns true if a compression program is available in PATH */ /* Returns true if a compression program is available in PATH */
static bool qemuCompressProgramAvailable(virQEMUSaveFormat compress) static bool
qemuCompressProgramAvailable(virQEMUSaveFormat compress)
{ {
const char *prog; char *path;
char *c;
if (compress == QEMU_SAVE_FORMAT_RAW) if (compress == QEMU_SAVE_FORMAT_RAW)
return true; return true;
prog = qemuSaveCompressionTypeToString(compress);
c = virFindFileInPath(prog); if (!(path = virFindFileInPath(qemuSaveCompressionTypeToString(compress))))
if (!c)
return false; return false;
VIR_FREE(c);
VIR_FREE(path);
return true; return true;
} }