From b5238e5a022184cbc13ebf510bc5081140867abe Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 27 Apr 2013 22:29:49 -0500 Subject: [PATCH 1/1] mount_image.c: Use fuse_context.umask only when available --- src/mount_image.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mount_image.c b/src/mount_image.c index 66e668af..bd27a46a 100644 --- a/src/mount_image.c +++ b/src/mount_image.c @@ -347,6 +347,15 @@ close_wimfs_fd(struct wimfs_fd *fd) return 0; } +static mode_t +fuse_mask_mode(mode_t mode, struct fuse_context *fuse_ctx) +{ +#if FUSE_MAJOR_VERSION > 2 || (FUSE_MAJOR_VERSION == 2 && FUSE_MINOR_VERSION >= 8) + mode &= ~fuse_ctx->umask; +#endif + return mode; +} + /* * Add a new dentry with a new inode to a WIM image. * @@ -385,7 +394,7 @@ create_dentry(struct fuse_context *fuse_ctx, const char *path, if (inode_set_unix_data(new->d_inode, fuse_ctx->uid, fuse_ctx->gid, - mode & ~fuse_ctx->umask, + fuse_mask_mode(mode, fuse_ctx), wimfs_ctx->wim->lookup_table, UNIX_DATA_ALL | UNIX_DATA_CREATE)) { -- 2.43.0