[libvirt] [RFC] virCommandRun return error number

harryxiyou harryxiyou at gmail.com
Thu Apr 11 13:48:27 UTC 2013


On Thu, Apr 11, 2013 at 9:38 PM, Michal Privoznik <mprivozn at redhat.com> wrote:
[...]
> Maybe you've pasted wrong code snippet, but the one you've pasted is
> correct. If virCommandRun() fails and returns -1; we return that value
> to the caller. And if the command doesn't fail, we call
> virStorageBackendSheepdogParseNodeInfo to parse output of the command.
>

Sorry, i have asked for a stupid bug. Let us check following one.

[...]
114 static int
115 virStorageBackendSheepdogRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
116                                      virStoragePoolObjPtr pool)
117 {
118     int ret;
119     char *output = NULL;
120     virCommandPtr cmd;
121
122     cmd = virCommandNewArgList(COLLIE, "node", "info", "-r", NULL);
123     virStorageBackendSheepdogAddHostArg(cmd, pool);
[...]

virCommandNewArgList may return ‘NULL’, so i think we should check
this condition, which we need not do following stuffs, right?


--
Thanks
Harry Wei




More information about the libvir-list mailing list