From def4175d0a4d0beb78b020f48f49638b604e506e Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sun, 24 May 2026 19:56:55 -0400 Subject: [PATCH] Fix aksl_sprintf, wasnt properly using va_args --- src/stdlib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stdlib.c b/src/stdlib.c index 3d2507f..ce0a20b 100644 --- a/src/stdlib.c +++ b/src/stdlib.c @@ -3,6 +3,7 @@ #include #include #include +#include akerr_ErrorContext AKERR_NOIGNORE *aksl_malloc(size_t size, void **dst) { @@ -122,6 +123,7 @@ akerr_ErrorContext AKERR_NOIGNORE *aksl_sprintf(int *count, char *restrict str, FAIL_ZERO_RETURN(e, count, AKERR_NULLPOINTER, "count=%p, str=%p, format=%p", (void *)count, (void *)str, (void *)format); FAIL_ZERO_RETURN(e, str, AKERR_NULLPOINTER, "count=%p, str=%p, format=%p", (void *)count, (void *)str, (void *)format); FAIL_ZERO_RETURN(e, format, AKERR_NULLPOINTER, "count=%p, str=%p, format=%p", (void *)count, (void *)str, (void *)format); + va_start(args, format); *count = vsprintf(str, format, args); FAIL_NONZERO_RETURN(e, (*count == -1), errno, "Short write"); SUCCEED_RETURN(e); @@ -160,6 +162,6 @@ akerr_ErrorContext AKERR_NOIGNORE *aksl_realpath(const char *restrict path, char PREPARE_ERROR(e); FAIL_ZERO_RETURN(e, path, AKERR_NULLPOINTER, "path=%p, dest=%p", (void *)path, (void *)resolved_path); result = realpath(path, resolved_path); - FAIL_ZERO_RETURN(e, result, errno, "Error"); + FAIL_ZERO_RETURN(e, result, errno, "path=%s, dest=%s", path, resolved_path); SUCCEED_RETURN(e); }