From: Diego Nieto Cid <[email protected]>

    ../../libps/fmt.c: In function '_fmt_create':
    ../../libps/fmt.c:181:21: warning: ignoring return value of 'asprintf' 
declared with attribute 'warn_unused_result' [-Wunused-result]
      181 |                     asprintf (err_string, "%s: Unknown format 
spec", src);
          |                     
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../libps/fmt.c:250:17: warning: ignoring return value of 'asprintf' 
declared with attribute 'warn_unused_result' [-Wunused-result]
      250 |                 asprintf (err_string, "%s: Unknown format spec", 
name);
          |                 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    ../../libps/fmt.c: In function 'ps_fmt_creation_error':
    ../../libps/fmt.c:340:5: warning: ignoring return value of 'asprintf' 
declared with attribute 'warn_unused_result' [-Wunused-result]
      340 |     asprintf (error, "%s", strerror (err));
---
 libps/fmt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libps/fmt.c b/libps/fmt.c
index 9904a230..0f419a52 100644
--- a/libps/fmt.c
+++ b/libps/fmt.c
@@ -339,7 +339,10 @@ ps_fmt_creation_error (char *src, int posix, struct 
ps_fmt_specs *fmt_specs,
   struct ps_fmt *fmt;
   error_t err = _fmt_create (src, posix, fmt_specs, &fmt, error);
   if (err != EINVAL)           /* ? */
-    asprintf (error, "%s", strerror (err));
+    {
+      int err2 = asprintf (error, "%s", strerror (err));
+      assert_backtrace (err2 != -1);
+    }
   if (! err)
     ps_fmt_free (fmt);
 }
-- 
2.51.0


Reply via email to