diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index c1b7d2268b..0dc0cecd53 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -766,8 +766,12 @@ virFirewallApply(virFirewallPtr firewall) goto cleanup; } if (!firewall || firewall->err) { - virReportSystemError(firewall->err, "%s", - _("Unable to create rule")); + int err = EINVAL; + + if (firewall) + err = firewall->err; + + virReportSystemError(err, "%s", _("Unable to create rule")); goto cleanup; }