]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Do not print warnings with "error:" prefix
authorJiri Denemark <jdenemar@redhat.com>
Thu, 22 May 2025 12:13:15 +0000 (14:13 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 22 May 2025 12:29:48 +0000 (14:29 +0200)
Both vshWarn and vshError are just wrappers around vshPrintStderr which
properly propagates the message level to the log, but fails to honor it
when printing on stderr.

https://issues.redhat.com/browse/RHEL-79460

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tools/vsh.c

index 05845e2c1ed3f5013c7ae971a61b1e672810a8fa..e892cbca22951ec72e48fd568b0a47fe8de50314 100644 (file)
@@ -2123,7 +2123,11 @@ vshPrintStderr(vshControl *ctl,
      * printing to stderr will not interleave correctly with stdout
      * unless we flush between every transition between streams.  */
     fflush(stdout);
-    fprintf(stderr, _("error: %1$s\n"), NULLSTR(str));
+
+    if (level == VSH_ERR_WARNING)
+        fprintf(stderr, _("warning: %1$s\n"), NULLSTR(str));
+    else
+        fprintf(stderr, _("error: %1$s\n"), NULLSTR(str));
     fflush(stderr);
 }