Add comma after every string and trim the final one.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
tools/virsh-domain.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index d21e77ce75..6124126576 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -13968,11 +13968,9 @@ cmdDomFSInfo(vshControl *ctl, const vshCmd *cmd)
virBuffer targetsBuff = VIR_BUFFER_INITIALIZER;
VIR_AUTOFREE(char *) targets = NULL;
- for (j = 0; j < info[i]->ndevAlias; j++) {
- virBufferAdd(&targetsBuff, info[i]->devAlias[j], -1);
- if (j != info[i]->ndevAlias - 1)
- virBufferAddChar(&targetsBuff, ',');
- }
+ for (j = 0; j < info[i]->ndevAlias; j++)
+ virBufferAsprintf(&targetsBuff, "%s,",
info[i]->devAlias[j]);
+ virBufferTrim(&targetsBuff, ",", -1);
targets = virBufferContentAndReset(&targetsBuff);
--
2.19.2