mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-08 06:42:27 -04:00
Merge pull request #409 from giuseppe/create-inodes-with-correct-mode
Create devices and dirs with correct mode with xattrs_permissions
This commit is contained in:
commit
906513ccba
14
main.c
14
main.c
@ -2864,9 +2864,7 @@ create_directory (struct ovl_data *lo, int dirfd, const char *name, const struct
|
|||||||
cleanup_free char *buf = NULL;
|
cleanup_free char *buf = NULL;
|
||||||
char wd_tmp_file_name[32];
|
char wd_tmp_file_name[32];
|
||||||
bool need_rename;
|
bool need_rename;
|
||||||
|
mode_t backing_file_mode = mode | (lo->xattr_permissions ? 0755 : 0);
|
||||||
if (lo->xattr_permissions)
|
|
||||||
mode |= 0755;
|
|
||||||
|
|
||||||
need_rename = set_opaque || times || xattr_sfd >= 0 || uid != lo->uid || gid != lo->gid;
|
need_rename = set_opaque || times || xattr_sfd >= 0 || uid != lo->uid || gid != lo->gid;
|
||||||
if (! need_rename)
|
if (! need_rename)
|
||||||
@ -2890,7 +2888,7 @@ create_directory (struct ovl_data *lo, int dirfd, const char *name, const struct
|
|||||||
|
|
||||||
sprintf (wd_tmp_file_name, "%lu", get_next_wd_counter ());
|
sprintf (wd_tmp_file_name, "%lu", get_next_wd_counter ());
|
||||||
|
|
||||||
ret = mkdirat (lo->workdir_fd, wd_tmp_file_name, mode);
|
ret = mkdirat (lo->workdir_fd, wd_tmp_file_name, backing_file_mode);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
@ -4914,6 +4912,7 @@ ovl_mknod (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, dev
|
|||||||
struct fuse_entry_param e;
|
struct fuse_entry_param e;
|
||||||
const struct fuse_ctx *ctx = fuse_req_ctx (req);
|
const struct fuse_ctx *ctx = fuse_req_ctx (req);
|
||||||
char wd_tmp_file_name[32];
|
char wd_tmp_file_name[32];
|
||||||
|
mode_t backing_file_mode = mode | (lo->xattr_permissions ? 0755 : 0);
|
||||||
|
|
||||||
if (UNLIKELY (ovl_debug (req)))
|
if (UNLIKELY (ovl_debug (req)))
|
||||||
fprintf (stderr, "ovl_mknod(ino=%" PRIu64 ", name=%s, mode=%d, rdev=%lu)\n",
|
fprintf (stderr, "ovl_mknod(ino=%" PRIu64 ", name=%s, mode=%d, rdev=%lu)\n",
|
||||||
@ -4927,9 +4926,6 @@ ovl_mknod (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, dev
|
|||||||
|
|
||||||
mode = mode & ~ctx->umask;
|
mode = mode & ~ctx->umask;
|
||||||
|
|
||||||
if (lo->xattr_permissions)
|
|
||||||
mode |= 0755;
|
|
||||||
|
|
||||||
node = do_lookup_file (lo, parent, name);
|
node = do_lookup_file (lo, parent, name);
|
||||||
if (node != NULL && ! node->whiteout)
|
if (node != NULL && ! node->whiteout)
|
||||||
{
|
{
|
||||||
@ -4951,7 +4947,7 @@ ovl_mknod (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, dev
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf (wd_tmp_file_name, "%lu", get_next_wd_counter ());
|
sprintf (wd_tmp_file_name, "%lu", get_next_wd_counter ());
|
||||||
ret = mknodat (lo->workdir_fd, wd_tmp_file_name, mode, rdev);
|
ret = mknodat (lo->workdir_fd, wd_tmp_file_name, backing_file_mode, rdev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
fuse_reply_err (req, errno);
|
fuse_reply_err (req, errno);
|
||||||
@ -5055,8 +5051,6 @@ ovl_mkdir (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode)
|
|||||||
fuse_reply_err (req, ENAMETOOLONG);
|
fuse_reply_err (req, ENAMETOOLONG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (lo->xattr_permissions)
|
|
||||||
mode |= 0755;
|
|
||||||
|
|
||||||
node = do_lookup_file (lo, parent, name);
|
node = do_lookup_file (lo, parent, name);
|
||||||
if (node != NULL && ! node->whiteout)
|
if (node != NULL && ! node->whiteout)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user