This new function can be used for printing warnings about suboptimal
usage.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
tools/virsh-secret.c | 2 +-
tools/vsh.c | 13 ++++++++++++-
tools/vsh.h | 2 ++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index d9435e4357..6655d3211e 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -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) {
diff --git a/tools/vsh.c b/tools/vsh.c
index 91e2ae2067..812fc81bde 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -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 */
diff --git a/tools/vsh.h b/tools/vsh.h
index 1c7370dd4f..5970addfb6 100644
--- a/tools/vsh.h
+++ b/tools/vsh.h
@@ -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);
--
2.48.1