Relocated the setting of the Windows read-only flag
parent
0634272756
commit
939a4a20b7
|
@ -2454,7 +2454,14 @@ int ntfs_set_inherited_posix(struct SECURITY_CONTEXT *scx,
|
|||
newattr = ntfs_build_descr_posix(scx->mapping, pxdesc,
|
||||
isdir, usid, gsid);
|
||||
if (newattr) {
|
||||
/* Adjust Windows read-only flag */
|
||||
res = update_secur_descr(scx->vol, newattr, ni);
|
||||
if (!res) {
|
||||
if (mode & S_IWUSR)
|
||||
ni->flags &= ~FILE_ATTR_READONLY;
|
||||
else
|
||||
ni->flags |= FILE_ATTR_READONLY;
|
||||
}
|
||||
#if CACHE_LEGACY_SIZE
|
||||
/* also invalidate legacy cache */
|
||||
if (isdir && !ni->security_id) {
|
||||
|
@ -2637,6 +2644,11 @@ int ntfs_set_owner_mode(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
|
|||
if (newattr) {
|
||||
res = update_secur_descr(scx->vol, newattr, ni);
|
||||
if (!res) {
|
||||
/* adjust Windows read-only flag */
|
||||
if (mode & S_IWUSR)
|
||||
ni->flags &= ~FILE_ATTR_READONLY;
|
||||
else
|
||||
ni->flags |= FILE_ATTR_READONLY;
|
||||
/* update cache, for subsequent use */
|
||||
if (test_nino_flag(ni, v3_Extensions)) {
|
||||
wanted.securid = ni->security_id;
|
||||
|
|
|
@ -970,13 +970,8 @@ static int ntfs_fuse_chmod(const char *path,
|
|||
else {
|
||||
if (ntfs_set_mode(&security,path,ni,mode))
|
||||
res = -errno;
|
||||
else {
|
||||
if (mode & S_IWUSR)
|
||||
ni->flags &= ~FILE_ATTR_READONLY;
|
||||
else
|
||||
ni->flags |= FILE_ATTR_READONLY;
|
||||
else
|
||||
ntfs_fuse_update_times(ni, NTFS_UPDATE_CTIME);
|
||||
}
|
||||
NInoSetDirty(ni);
|
||||
if (ntfs_inode_close(ni))
|
||||
set_fuse_error(&res);
|
||||
|
@ -1193,14 +1188,7 @@ static int ntfs_fuse_create(const char *org_path, dev_t typemode, dev_t dev,
|
|||
security.uid, security.gid, perm) < 0)
|
||||
set_fuse_error(&res);
|
||||
#endif
|
||||
else {
|
||||
/* Adjust read-only (for Windows) */
|
||||
if (perm & S_IWUSR)
|
||||
ni->flags &= ~FILE_ATTR_READONLY;
|
||||
else
|
||||
ni->flags |= FILE_ATTR_READONLY;
|
||||
}
|
||||
}
|
||||
}
|
||||
NInoSetDirty(ni);
|
||||
if (ntfs_inode_close(ni))
|
||||
set_fuse_error(&res);
|
||||
|
|
Loading…
Reference in New Issue