From db92bd35807305e6daec5ec40bd67cbc43fe88ee Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Thu, 10 Oct 2024 10:26:28 -0600 Subject: lib9p: Implemnt Topen, add permission checks in Twalk --- lib9p/9p.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib9p/9p.c') diff --git a/lib9p/9p.c b/lib9p/9p.c index 0e71071..b1d4c32 100644 --- a/lib9p/9p.c +++ b/lib9p/9p.c @@ -14,6 +14,8 @@ #include "internal.h" int lib9p_error(struct lib9p_ctx *ctx, uint32_t linux_errno, char const *msg) { + if (lib9p_ctx_has_error(ctx)) + return -1; strncpy(ctx->err_msg, msg, sizeof(ctx->err_msg)); ctx->err_msg[sizeof(ctx->err_msg)-1] = '\0'; ctx->err_num = linux_errno; @@ -24,6 +26,8 @@ int lib9p_errorf(struct lib9p_ctx *ctx, uint32_t linux_errno, char const *fmt, . int n; va_list args; + if (lib9p_ctx_has_error(ctx)) + return -1; va_start(args, fmt); n = vsnprintf(ctx->err_msg, sizeof(ctx->err_msg), fmt, args); va_end(args); -- cgit v1.2.3-2-g168b