summaryrefslogtreecommitdiff
path: root/lib9p/9p.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib9p/9p.c')
-rw-r--r--lib9p/9p.c4
1 files changed, 4 insertions, 0 deletions
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);