]> Git Repo - binutils.git/blobdiff - libctf/ctf-subr.c
Automatic date update in version.in
[binutils.git] / libctf / ctf-subr.c
index c902494590c15693a48d64009605034e0f358b0e..83572320f4cbb1c37e28481b3c0ee29cfd62a719 100644 (file)
@@ -1,5 +1,5 @@
 /* Simple subrs.
-   Copyright (C) 2019-2020 Free Software Foundation, Inc.
+   Copyright (C) 2019-2022 Free Software Foundation, Inc.
 
    This file is part of libctf.
 
@@ -225,10 +225,12 @@ ctf_err_warn (ctf_dict_t *fp, int is_warning, int err,
     }
   va_end (alist);
 
-  /* Include the error code only if there is one, and if this is not a warning.
+  /* Include the error code only if there is one; if this is not a warning,
+     only use the error code if it was explicitly passed and is nonzero.
      (Warnings may not have a meaningful error code, since the warning may not
      lead to unwinding up to the user.)  */
-  if (!is_warning && (err != 0 || (fp && ctf_errno (fp) != 0)))
+  if ((!is_warning && (err != 0 || (fp && ctf_errno (fp) != 0)))
+      || (is_warning && err != 0))
     ctf_dprintf ("%s: %s (%s)\n", is_warning ? _("error") : _("warning"),
                 cew->cew_text, err != 0 ? ctf_errmsg (err)
                 : ctf_errmsg (ctf_errno (fp)));
This page took 0.019865 seconds and 4 git commands to generate.