Set default ACL rules for directories only 80/320080/4
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Fri, 21 Feb 2025 15:38:54 +0000 (16:38 +0100)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 3 Mar 2025 10:34:32 +0000 (10:34 +0000)
Default ACL rules can be set on directories so that files and
directories created in them get the ACLs automatically.

The goal of this commit is to properly handle a rare case where an
application path is not a directory but a file.

Change-Id: Iac20c15e689b23486966649f2dc2222614942743

src/common/smack-labels.cpp

index 94837e3e7b0a55e794def83185d5e5eb8ea72863..328b6569b9cf7ee5861f05bc34f792332aabf730 100644 (file)
@@ -204,7 +204,7 @@ public:
          *    that.
          *  - Default ACL rules will be applied from the parent directory.
          */
-        if (m_transmute && ftsent->fts_level == 0) {
+        if (m_transmute && ftsent->fts_level == 0 && ftsent->fts_info == FTS_D) {
             // need to re-read the mode after ACL application above
             struct stat statbuf;
             if (0 != stat(ftsent->fts_path, &statbuf))