summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-03-14 18:10:31 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-02 20:44:53 -0600
commitece605ec021de84aa1a9e282f342c38505ba794b (patch)
treefc70d13d59f454d58d5b129eb2a8abaf57a7c9e5
parent4342605da113113e9f4c80f1237a6e7b4459e180 (diff)
lib9p: Use fmt_vsnprintf instead of plain vsnprintf
-rw-r--r--lib9p/9p.c5
-rw-r--r--lib9p/CMakeLists.txt1
2 files changed, 4 insertions, 2 deletions
diff --git a/lib9p/9p.c b/lib9p/9p.c
index e90ef30..4ef4e03 100644
--- a/lib9p/9p.c
+++ b/lib9p/9p.c
@@ -6,9 +6,10 @@
#include <inttypes.h> /* for PRIu{n} */
#include <stdarg.h> /* for va_* */
-#include <stdio.h> /* for vsnprintf() */
#include <string.h> /* for strncpy() */
+#include <pico/fmt_printf.h> /* for fmt_vsnprintf() */
+
#include <lib9p/9p.h>
/* strings ********************************************************************/
@@ -79,7 +80,7 @@ int lib9p_errorf(struct lib9p_ctx *ctx, lib9p_errno_t linux_errno, char const *f
if (lib9p_ctx_has_error(ctx))
return -1;
va_start(args, fmt);
- n = vsnprintf(ctx->err_msg, sizeof(ctx->err_msg), fmt, args);
+ n = fmt_vsnprintf(ctx->err_msg, sizeof(ctx->err_msg), fmt, args);
va_end(args);
if ((size_t)(n+1) < sizeof(ctx->err_msg))
memset(&ctx->err_msg[n+1], 0, sizeof(ctx->err_msg)-(n+1));
diff --git a/lib9p/CMakeLists.txt b/lib9p/CMakeLists.txt
index 9240aa3..24f9d71 100644
--- a/lib9p/CMakeLists.txt
+++ b/lib9p/CMakeLists.txt
@@ -12,6 +12,7 @@ target_sources(lib9p INTERFACE
srv.c
)
target_link_libraries(lib9p INTERFACE
+ pico_fmt
libcr_ipc
libmisc
libhw_generic