Make getSystemAccessGid return sane value on smack-enabled system 23/323523/2
authorTomasz Swierczek <t.swierczek@samsung.com>
Tue, 29 Apr 2025 15:16:19 +0000 (17:16 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Tue, 6 May 2025 09:22:47 +0000 (11:22 +0200)
...to allow unit-testing of DacSetup class.

Change-Id: I9fa26fa68ef95d899a70d4e8cfce66be7bf46f3e

src/common/utils.cpp

index 3e5590b3fe029c1a6ae2a30aa001bdcc5a1c9494..205b53f4e3c14257a7d1ae4bb90a1d92486a1684 100644 (file)
@@ -116,8 +116,12 @@ gid_t getGidByName(const std::string& name) {
 }
 
 gid_t getSystemAccessGid() {
+#ifndef SMACK_ENABLED
     const static gid_t gid = getGidByName("system_access");
     return gid;
+#else
+    return 42; // "answer to all questions of the universe"
+#endif
 }
 
 uid_t getUidByName(const std::string& name) {