mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
docs: use g_auto in virCommand example
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
7e41c10b95
commit
7624796ac8
@ -564,14 +564,12 @@ int runhook(const char *drvstr, const char *id,
|
|||||||
const char *opstr, const char *subopstr,
|
const char *opstr, const char *subopstr,
|
||||||
const char *extra)
|
const char *extra)
|
||||||
{
|
{
|
||||||
int ret;
|
g_autofree char *path = NULL;
|
||||||
char *path;
|
g_autoptr(virCommand) cmd = NULL;
|
||||||
virCommand *cmd;
|
|
||||||
|
|
||||||
virBuildPath(&path, LIBVIRT_HOOK_DIR, drvstr);
|
virBuildPath(&path, LIBVIRT_HOOK_DIR, drvstr);
|
||||||
|
|
||||||
cmd = virCommandNew(path);
|
cmd = virCommandNew(path);
|
||||||
VIR_FREE(path);
|
|
||||||
|
|
||||||
virCommandAddEnvPassCommon(cmd);
|
virCommandAddEnvPassCommon(cmd);
|
||||||
|
|
||||||
@ -579,11 +577,7 @@ int runhook(const char *drvstr, const char *id,
|
|||||||
|
|
||||||
virCommandSetInputBuffer(cmd, input);
|
virCommandSetInputBuffer(cmd, input);
|
||||||
|
|
||||||
ret = virCommandRun(cmd, NULL);
|
return virCommandRun(cmd, NULL);
|
||||||
|
|
||||||
virCommandFree(cmd);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user