Fixed setting of read-only flag

N2009_11_14_FIXES
jpandre 2007-11-20 13:48:15 +00:00
parent 3a51d80655
commit f73e9ed9ce
2 changed files with 7 additions and 10 deletions

View File

@ -3277,10 +3277,6 @@ int ntfs_set_owner_mode(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
/* quite simple, if we are lucky */
if (cached) {
ni->security_id = cached->securid;
if (mode & S_IWUSR)
ni->flags &= ~FILE_ATTR_READONLY;
else
ni->flags |= FILE_ATTR_READONLY;
NInoSetDirty(ni);
}
} else cached = (struct CACHED_SECURID*)NULL;

View File

@ -1067,16 +1067,17 @@ static int ntfs_fuse_create(const char *org_path, dev_t typemode, dev_t dev,
* set the security attribute if a security id
* could not be allocated (eg NTFS 1.x)
*/
if (!securid && ctx->security.usermapping) {
if (ntfs_set_owner_mode(&security, ni,
if (ctx->security.usermapping) {
if (!securid
&& ntfs_set_owner_mode(&security, ni,
security.uid, security.gid, perm) < 0)
set_fuse_error(&res);
else {
/* Adjust read-only (for Windows) */
if (perm & S_IWUSR)
ni->flags &= ~FILE_ATTR_READONLY;
else
ni->flags |= FILE_ATTR_READONLY;
if (perm & S_IWUSR)
ni->flags &= ~FILE_ATTR_READONLY;
else
ni->flags |= FILE_ATTR_READONLY;
}
}
NInoSetDirty(ni);