From 3e4826f758a07407a9a9157fe630b8bc00ede175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Mon, 19 Apr 2010 11:03:54 +0200 Subject: [PATCH] fixed modifying the read-only flag on a directory --- libntfs-3g/security.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libntfs-3g/security.c b/libntfs-3g/security.c index 213d88c0..9c1bbd03 100644 --- a/libntfs-3g/security.c +++ b/libntfs-3g/security.c @@ -2639,7 +2639,7 @@ int ntfs_set_inherited_posix(struct SECURITY_CONTEXT *scx, if (newattr) { /* Adjust Windows read-only flag */ res = update_secur_descr(scx->vol, newattr, ni); - if (!res) { + if (!res && !isdir) { if (mode & S_IWUSR) ni->flags &= ~FILE_ATTR_READONLY; else @@ -2828,10 +2828,13 @@ int ntfs_set_owner_mode(struct SECURITY_CONTEXT *scx, ntfs_inode *ni, 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; + if (!isdir) { + if (mode & S_IWUSR) + ni->flags &= ~FILE_ATTR_READONLY; + else + ni->flags |= FILE_ATTR_READONLY; + NInoFileNameSetDirty(ni); + } /* update cache, for subsequent use */ if (test_nino_flag(ni, v3_Extensions)) { wanted.securid = ni->security_id;