From 860a9e995b8e7076ce4e5c231e844184bef9b95e Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Fri, 4 Oct 2024 17:39:24 -0600 Subject: wip --- lib9p/srv.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib9p/srv.c') diff --git a/lib9p/srv.c b/lib9p/srv.c index 0f9466c..534d70a 100644 --- a/lib9p/srv.c +++ b/lib9p/srv.c @@ -375,7 +375,7 @@ static void handle_Tauth(struct lib9p_req *ctx, struct lib9p_msg_Tauth *req, str return; } -static void handle_Tattach(struct lib9p_req *ctx, struct lib9p_msg_Tattach *req, struct lib9p_msg_Rattach *UNUSED(resp)) { +static void handle_Tattach(struct lib9p_req *ctx, struct lib9p_msg_Tattach *req, struct lib9p_msg_Rattach *resp) { struct lib9p_srv_reqctx subctx = { .base = &ctx->ctx, .uid = req->n_uname, @@ -418,6 +418,13 @@ static void handle_Tattach(struct lib9p_req *ctx, struct lib9p_msg_Tattach *req, if (lib9p_ctx_has_error(&ctx->ctx)) return; + struct lib9p_stat stat = rootdir.vtable.stat(&subctx, rootdir.impldata); + if (lib9p_ctx_has_error(&ctx->ctx)) { + if (rootdir.vtable.free) + rootdir.vtable.free(&subctx, rootdir.impldata); + return; + } + struct lib9p_srv_file *rootdir_ptr = fidmap_store(&ctx->parent_sess->fids, req->fid, rootdir); if (!rootdir_ptr) { lib9p_error(&ctx->ctx, LINUX_EMFILE, "too many open files"); @@ -426,7 +433,7 @@ static void handle_Tattach(struct lib9p_req *ctx, struct lib9p_msg_Tattach *req, return; } - //resp->qid = rootdir.qid; + resp->qid = stat.file_qid; return; } -- cgit v1.2.3-2-g168b