Whamcloud - gitweb
fuse2fs: set inode's uid/gid when creating inode
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 30 Nov 2015 23:28:42 +0000 (18:28 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 30 Nov 2015 23:28:42 +0000 (18:28 -0500)
When creating a file in op_create, set the file's uid and gid to the
user's uid and gid.  Do the same in op_mknod.

Reported-by: Lennart Lövstrand <lennart@lovstrand.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/fuse2fs.c

index 7d8bb60..1cbdcb7 100644 (file)
@@ -994,6 +994,8 @@ static int op_mknod(const char *path, mode_t mode, dev_t dev)
        inode.i_links_count = 1;
        inode.i_extra_isize = sizeof(struct ext2_inode_large) -
                EXT2_GOOD_OLD_INODE_SIZE;
+       inode.i_uid = ctxt->uid;
+       inode.i_gid = ctxt->gid;
 
        err = ext2fs_write_new_inode(fs, child, (struct ext2_inode *)&inode);
        if (err) {
@@ -2895,6 +2897,8 @@ static int op_create(const char *path, mode_t mode, struct fuse_file_info *fp)
        inode.i_links_count = 1;
        inode.i_extra_isize = sizeof(struct ext2_inode_large) -
                EXT2_GOOD_OLD_INODE_SIZE;
+       inode.i_uid = ctxt->uid;
+       inode.i_gid = ctxt->gid;
        if (ext2fs_has_feature_extents(fs->super)) {
                ext2_extent_handle_t handle;