[10/19] libctf, subr: don't mix up errors and warnings

Message ID 20240730153707.168357-11-nick.alcock@oracle.com
State New
Headers
Series libctf: various bugfixes (including a write into freed memory), and loosen constraints on enums |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Patch failed to apply

Commit Message

Nick Alcock July 30, 2024, 3:36 p.m. UTC
  ctf_err_warn() was debug-logging warnings as if they were errors and vice
versa.

libctf/
	* ctf-subr.c (ctf_err_warn): Fix debugging thinko.
---
 libctf/ctf-subr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/libctf/ctf-subr.c b/libctf/ctf-subr.c
index deb9e0ba5c4..6dbf3e7231a 100644
--- a/libctf/ctf-subr.c
+++ b/libctf/ctf-subr.c
@@ -231,11 +231,11 @@  ctf_err_warn (ctf_dict_t *fp, int is_warning, int err,
      lead to unwinding up to the user.)  */
   if ((!is_warning && (err != 0 || (fp && ctf_errno (fp) != 0)))
       || (is_warning && err != 0))
-    ctf_dprintf ("%s: %s (%s)\n", is_warning ? _("error") : _("warning"),
+    ctf_dprintf ("%s: %s (%s)\n", is_warning ? _("warning") : _("error"),
 		 cew->cew_text, err != 0 ? ctf_errmsg (err)
 		 : ctf_errmsg (ctf_errno (fp)));
   else
-    ctf_dprintf ("%s: %s\n", is_warning ? _("error") : _("warning"),
+    ctf_dprintf ("%s: %s\n", is_warning ? _("warning") : _("error"),
 		 cew->cew_text);
 
   if (fp != NULL)