]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Introduce vshWarn
authorJiri Denemark <jdenemar@redhat.com>
Thu, 20 Feb 2025 12:17:47 +0000 (13:17 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 24 Feb 2025 10:14:11 +0000 (11:14 +0100)
This new function can be used for printing warnings about suboptimal
usage.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/virsh-secret.c
tools/vsh.c
tools/vsh.h

index d9435e4357b9e664a38a39d44a844ec4417aa240..6655d3211e432c7b14b1d38207eab121fb33dcb4 100644 (file)
@@ -235,7 +235,7 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd)
 
     if (base64) {
         /* warn users that the --base64 option passed from command line is wrong */
-        vshError(ctl, _("Passing secret value as command-line argument is insecure!"));
+        vshWarn(ctl, _("Passing secret value as command-line argument is insecure!"));
         secret_val = g_strdup(base64);
         secret_len = strlen(secret_val);
     } else if (filename) {
index 91e2ae20672d9f0425a962561faa16325f51de55..812fc81bdeb7e0f3e543c92cc25296be1f0678c3 100644 (file)
@@ -2144,6 +2144,17 @@ vshError(vshControl *ctl, const char *format, ...)
 }
 
 
+void
+vshWarn(vshControl *ctl, const char *format, ...)
+{
+    va_list ap;
+
+    va_start(ap, format);
+    vshPrintStderr(ctl, VSH_ERR_WARNING, format, ap);
+    va_end(ap);
+}
+
+
 void
 vshEventLoop(void *opaque)
 {
@@ -2501,7 +2512,7 @@ vshAskReedit(vshControl *ctl,
              const char *msg G_GNUC_UNUSED,
              bool relax_avail G_GNUC_UNUSED)
 {
-    vshDebug(ctl, VSH_ERR_WARNING, "%s", _("This function is not supported on WIN32 platform"));
+    vshWarn(ctl, "%s", _("This function is not supported on WIN32 platform"));
     return 0;
 }
 #endif /* WIN32 */
index 1c7370dd4fbdd564b27bf949207360f9f492a864..5970addfb6ef26c7a8f4055f36c774932b25f16f 100644 (file)
@@ -240,6 +240,8 @@ struct _vshCmdGrp {
 
 void vshError(vshControl *ctl, const char *format, ...)
     G_GNUC_PRINTF(2, 3);
+void vshWarn(vshControl *ctl, const char *format, ...)
+    G_GNUC_PRINTF(2, 3);
 void vshOpenLogFile(vshControl *ctl);
 void vshOutputLogFile(vshControl *ctl, int log_level, const char *msg);
 void vshCloseLogFile(vshControl *ctl);