[libvirt] [PATCH 9/9] virsh: allow empty targets in cmdDomFSInfo

Ján Tomko jtomko at redhat.com
Tue Feb 12 12:30:55 UTC 2019


On Tue, Feb 12, 2019 at 01:17:25PM +0100, Michal Privoznik wrote:
>On 2/12/19 10:21 AM, Ján Tomko wrote:
>>Ever since the introduction of the guest-get-fsinfo command
>>in QEMU commit 46d4c572 qga/qapi-schema.json says that
>>the 'disks' array can possibly be empty. For example when getting
>>the target list is unsupported:
>>https://bugzilla.redhat.com/show_bug.cgi?id=1567041
>>
>>Pass an empty string instead of NULL to vshTableRowAppend to prevent
>>a mismatched column number.
>>
>>Signed-off-by: Ján Tomko <jtomko at redhat.com>
>>---
>>  tools/virsh-domain.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>>diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
>>index 6124126576..686fea8dd1 100644
>>--- a/tools/virsh-domain.c
>>+++ b/tools/virsh-domain.c
>>@@ -13978,7 +13978,7 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd)
>>                                    info[i]->mountpoint,
>>                                    info[i]->name,
>>                                    info[i]->fstype,
>>-                                  targets,
>>+                                  targets ? : "",
>
>Last time I posted a patch that had this I was told (most probably by 
>Eric) that this is not portable. I think we need to use expanded 
>version.
>

There actually is some usage that sneaked into our code:
ChangeLog-old:  * src/remote_internal.c: Remove gcc-ism in empty "x ? : y"
src/util/virdbus.c:                           localerror.message ? : _("unknown error"));
src/vz/vz_sdk.c:    pret = PrlVmCfg_SetVNCPassword(sdkdom, gr->data.vnc.auth.passwd ? : "");
src/vz/vz_sdk.c:    pret = PrlVmDevNet_SetDefaultGateway(sdknet, gw4 ? : "");
src/vz/vz_sdk.c:    pret = PrlVmDevNet_SetDefaultGatewayIPv6(sdknet, gw6 ? : "");
src/vz/vz_sdk.c:    const char *path = disk->src->path ? : "";
src/vz/vz_sdk.c:                               description ? : "");

but I guess neither D-Bus nor vz are that portable.

I have no problems using the portable version here.

Jano

>>                                    NULL) < 0)
>>                  goto cleanup;
>>          }
>>
>
>Michal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190212/da1bd104/attachment-0001.sig>


More information about the libvir-list mailing list