From 7797823afa1890e22774089f79634f631c4d0cb9 Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Tue, 23 Jul 2019 10:52:16 +0100 Subject: [PATCH] util: fix asprintf() fallback Fixes: 9607d499dcdd09160b13 ("util: add asprintf() wrapper for MSVC") Signed-off-by: Eric Engestrom Reviewed-by: Alyssa Rosenzweig --- src/util/u_string.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/util/u_string.h b/src/util/u_string.h index e7163927667..5fea8f17e73 100644 --- a/src/util/u_string.h +++ b/src/util/u_string.h @@ -99,16 +99,15 @@ util_vasprintf(char **ret, const char *format, va_list ap) } #define asprintf util_asprintf -static inline char * -util_asprintf(const char *fmt, ...) +static inline int +util_asprintf(char **str, const char *fmt, ...) { - char *ptr; + int ret; va_list args; va_start(args, fmt); - if (vasprintf(&ptr, fmt, args) == -1) - ptr = NULL; + ret = vasprintf(str, fmt, args); va_end(args); - return ptr; + return ret; } #define strcasecmp stricmp -- 2.30.2