Mercurial > nomad
changeset 793:55b8061a7cf9
fs: pass current context uid/gid to fscall_create
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Thu, 02 Apr 2020 14:45:21 -0400 |
parents | e1086d53181a |
children | 14dbffbeb60c |
files | src/fs/nomadfs.c |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fs/nomadfs.c Thu Apr 02 14:44:23 2020 -0400 +++ b/src/fs/nomadfs.c Thu Apr 02 14:45:21 2020 -0400 @@ -96,14 +96,20 @@ static int __create(fuse_req_t req, fuse_ino_t parent, const char *name, uint16_t mode, struct noid *child_oid) { + const struct fuse_ctx *fuse_ctx; uint32_t dir_ohandle; int ret; + fuse_ctx = fuse_req_ctx(req); + if (!fuse_ctx) + return -EPERM; /* TODO: is there a better errno? */ + ret = fscall_open(&state, NULL, ino_fuse2nomad(parent), &dir_ohandle); if (ret) return ret; - ret = fscall_create(&state, dir_ohandle, name, 0, 0, mode, child_oid); + ret = fscall_create(&state, dir_ohandle, name, fuse_ctx->uid, + fuse_ctx->gid, mode, child_oid); if (ret) goto err;