diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-06-12 02:32:54 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-06-12 02:32:54 -0600 |
commit | 0474953ab2600ee3b6bc17ba605b8e7877e181fe (patch) | |
tree | 5d3d4499d81d6a9f5422caf0694051272a1f6335 /lib9p/srv.c | |
parent | 8ce568bae1cc9a77996f16b859482992d27e0b37 (diff) | |
parent | 43cacf95462588de0ab3125bdea7a37f10ebf8fc (diff) |
Merge branch 'lukeshu/better-net-flash'
Diffstat (limited to 'lib9p/srv.c')
-rw-r--r-- | lib9p/srv.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib9p/srv.c b/lib9p/srv.c index 03d7b93..295bc1d 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -711,11 +711,13 @@ static inline void _srv_respond(struct srv_req *ctx, enum lib9p_msg_type resp_ty /* handle_T* ******************************************************************/ -#define srv_handler_common(ctx, typ, req) \ +#define srv_handler_common_no_err(ctx, typ, req) \ assert(ctx); \ assert(req); \ struct lib9p_msg_T##typ *_typecheck_req [[maybe_unused]] = req; \ - struct lib9p_msg_R##typ resp = { .tag = ctx->tag }; \ + struct lib9p_msg_R##typ resp = { .tag = ctx->tag } +#define srv_handler_common(ctx, typ, req) \ + srv_handler_common_no_err(ctx, typ, req); \ error err = {} static void handle_Tversion(struct srv_req *ctx, @@ -1412,18 +1414,17 @@ static void handle_Twrite(struct srv_req *ctx, static void handle_Tclunk(struct srv_req *ctx, struct lib9p_msg_Tclunk *req) { - srv_handler_common(ctx, clunk, req); + srv_handler_common_no_err(ctx, clunk, req); struct srv_fidinfo *fidinfo = map_load(&ctx->parent_sess->fids, req->fid); if (!fidinfo) { - err = error_new(E_POSIX_EBADF, "bad file number ", req->fid); - goto tclunk_return; + srv_respond(ctx, clunk, NULL, error_new(E_POSIX_EBADF, "bad file number ", req->fid)); + return; } + srv_respond(ctx, clunk, &resp, ERROR_NULL); + /* Yes, don't actually perform the clunk until *after* we send Rclunk. */ srv_fid_del(ctx, req->fid, fidinfo, false); - - tclunk_return: - srv_respond(ctx, clunk, &resp, err); } static void handle_Tremove(struct srv_req *ctx, |