SVACE: Fix UNREACHABLE_CODE (WGID 543176) 79/297179/2
authorDongkyun Son <dongkyun.s@samsung.com>
Fri, 11 Aug 2023 07:22:04 +0000 (16:22 +0900)
committerDongkyun Son <dongkyun.s@samsung.com>
Fri, 11 Aug 2023 07:45:17 +0000 (16:45 +0900)
Redundant comparison rootshell_mode == 1 (0 == 1) is always false

https://analysishub.sec.samsung.net/dm/tizen/sb2/main/review#PRJID=1177&WGID=543176

Change-Id: Ie02831e0e1ec5211ad4c2336eb0ee0cd048765f9
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
src/sdb.c

index 7b79f521b75dc9eb28d98306499a3382b3fa29fc..255ebc3a792e89ec22af2c6272c17ee10c70cdd7 100755 (executable)
--- a/src/sdb.c
+++ b/src/sdb.c
@@ -1306,10 +1306,7 @@ static void init_drop_privileges() {
 }
 
 int should_drop_privileges() {
-    if (rootshell_mode == 1) { // if root, then don't drop
-        return 0;
-    }
-    return 1;
+    return !rootshell_mode; // if root, then don't drop
 }
 
 #include <gio/gio.h>