about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY3
-rw-r--r--lib/util/nstring.c4
2 files changed, 5 insertions, 2 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 333061c8..80fe6b40 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -6,6 +6,9 @@ CHANGE HISTORY
 
 notyet   BJH  Release 11.05.00
 
+              Fix compile error on systems without 'asprintf'.  Introduced
+              in Netpbm 11.04 (September 2023).
+
 23.09.27 BJH  Release 11.04.00
 
               pamaddnoise: add -salt.
diff --git a/lib/util/nstring.c b/lib/util/nstring.c
index 623fd7b7..29da8fe5 100644
--- a/lib/util/nstring.c
+++ b/lib/util/nstring.c
@@ -84,7 +84,7 @@ pm_asprintf(const char ** const resultP,
 
     va_start(varargs, fmt);
 
-    vsnprintf(NULL, 0, fmt, varargs, &dryRunLen);
+    dryRunLen = vsnprintf(NULL, 0, fmt, varargs);
 
     va_end(varargs);
 
@@ -101,7 +101,7 @@ pm_asprintf(const char ** const resultP,
 
             va_start(varargs, fmt);
 
-            vsnprintf(buffer, allocSize, fmt, varargs, &realLen);
+            realLen = vsnprintf(buffer, allocSize, fmt, varargs);
 
             assert(realLen == dryRunLen);
             va_end(varargs);