From a0c9b41d35df3b1373fb667d34136f979dfee87a Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Thu, 20 Nov 2025 13:33:48 +0530 Subject: [PATCH] daemon: modernize notify_progress_no_ratelimit: compound literal Signed-off-by: Susant Sahani --- daemon/proto.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/daemon/proto.c b/daemon/proto.c index a5bb8f25a..9f14e3361 100644 --- a/daemon/proto.c +++ b/daemon/proto.c @@ -633,7 +633,6 @@ notify_progress_no_ratelimit (uint64_t position, uint64_t total, char buf[128]; uint32_t i; size_t len; - guestfs_progress message; count_progress++; last_progress_t = *now_t; @@ -647,17 +646,21 @@ notify_progress_no_ratelimit (uint64_t position, uint64_t total, if (xwrite (sock, buf, 4) == -1) error (EXIT_FAILURE, 0, "xwrite failed"); - message.proc = proc_nr; - message.serial = serial; - message.position = position; - message.total = total; - + /* Send progress message */ xdrmem_create (&xdr, buf, sizeof buf, XDR_ENCODE); - if (!xdr_guestfs_progress (&xdr, &message)) { + + if (!xdr_guestfs_progress (&xdr, + &(guestfs_progress){ + .proc = proc_nr, + .serial = serial, + .position = position, + .total = total, + })) { fprintf (stderr, "guestfsd: xdr_guestfs_progress: failed to encode message\n"); xdr_destroy (&xdr); return; } + len = xdr_getpos (&xdr); xdr_destroy (&xdr);