Browse Source

ext4: ext4_chmod now only allows modifying the lowest 12bit of i_mode.

pull/11/head
ngkaho1234 9 years ago
parent
commit
9293ce9f84
  1. 7
      lwext4/ext4.c

7
lwext4/ext4.c

@ -1989,7 +1989,7 @@ uint64_t ext4_fsize(ext4_file *f)
int ext4_chmod(const char *path, uint32_t mode)
{
int r;
uint32_t ino;
uint32_t ino, orig_mode;
ext4_file f;
struct ext4_sblock *sb;
struct ext4_inode_ref inode_ref;
@ -2017,7 +2017,10 @@ int ext4_chmod(const char *path, uint32_t mode)
return r;
}
ext4_inode_set_mode(sb, inode_ref.inode, mode);
orig_mode = ext4_inode_get_mode(sb, inode_ref.inode);
orig_mode &= ~0xFFF;
orig_mode |= mode & 0xFFF;
ext4_inode_set_mode(sb, inode_ref.inode, orig_mode);
inode_ref.dirty = true;
r = ext4_fs_put_inode_ref(&inode_ref);

Loading…
Cancel
Save