diff options
Diffstat (limited to 'lib9p')
-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, |