From 8fb58de7626626248a05b4add5756c424b79c04b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Fri, 17 Apr 2015 10:35:26 +0200 Subject: [PATCH] Updated the read-only flag even when the security attribute was cached When chmod'ing a file, no new ACL has to be created if the one needed is already present in the cache. However the read-only flag may have to be updated, so that it is kept as the opposite of S_IWUSR. --- libntfs-3g/security.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libntfs-3g/security.c b/libntfs-3g/security.c index e6d0587c..3ac4790a 100644 --- a/libntfs-3g/security.c +++ b/libntfs-3g/security.c @@ -4,7 +4,7 @@ * Copyright (c) 2004 Anton Altaparmakov * Copyright (c) 2005-2006 Szabolcs Szakacsits * Copyright (c) 2006 Yura Pakhuchiy - * Copyright (c) 2007-2014 Jean-Pierre Andre + * Copyright (c) 2007-2015 Jean-Pierre Andre * * This program/include file is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as published @@ -2916,6 +2916,14 @@ int ntfs_set_owner_mode(struct SECURITY_CONTEXT *scx, ntfs_inode *ni, if (cached) { ni->security_id = cached->securid; NInoSetDirty(ni); + /* adjust Windows read-only flag */ + if (!isdir) { + if (mode & S_IWUSR) + ni->flags &= ~FILE_ATTR_READONLY; + else + ni->flags |= FILE_ATTR_READONLY; + NInoFileNameSetDirty(ni); + } } } else cached = (struct CACHED_SECURID*)NULL;