From 3b43fa08ffa58d786d781f675419f151481ddb45 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Fri, 18 Jul 2025 16:49:11 +0200 Subject: [PATCH] virSecuritySELinuxGetSecurityMountOptions: refactor printing MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fix linebreaks and remove the use of ternary operator. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/security/security_selinux.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 9d14e33340..fa5d1568eb 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -3526,23 +3526,24 @@ virSecuritySELinuxGetSecurityMountOptions(virSecurityManager *mgr, { char *opts = NULL; virSecurityLabelDef *secdef; + const char *imagelabel = NULL; if ((secdef = virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME))) { if (!secdef->imagelabel) secdef->imagelabel = virSecuritySELinuxGenImageLabel(mgr, def); if (secdef->imagelabel) { - opts = g_strdup_printf( - ",context=\"%s\"", + opts = g_strdup_printf(",context=\"%s\"", (const char*) secdef->imagelabel); } + + imagelabel = secdef->imagelabel; } if (!opts) opts = g_strdup(""); - VIR_DEBUG("imageLabel=%s opts=%s", - secdef ? secdef->imagelabel : "(null)", opts); + VIR_DEBUG("imageLabel=%s opts=%s", NULLSTR(imagelabel), opts); return opts; } -- 2.47.2