1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

virsh: Introduce vshWarn

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>
This commit is contained in:
Jiri Denemark 2025-02-20 13:17:47 +01:00
parent c12f92a05e
commit 71fe4b97a9
3 changed files with 15 additions and 2 deletions

View 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) {

View 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 */

View 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);