Fix issue detected by static analysis tool 80/196980/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 8 Jan 2019 10:10:11 +0000 (19:10 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 8 Jan 2019 10:10:11 +0000 (19:10 +0900)
Change-Id: Icc95ff7e03a79c8e62731f849dfba5848bb8d2ff
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
privilege_checker/privilege_checker.c

index e75a372..05f6c24 100644 (file)
@@ -19,6 +19,7 @@ check_privilege(const char *privilege)
     char label_path[1024] = "/proc/self/attr/current";
     char smack_label[1024] = {'\0', };
     char uid[10] = {0,};
+    int num;
 
     int ret = cynara_initialize(&p_cynara, NULL);
     if (ret != CYNARA_API_SUCCESS) {
@@ -31,7 +32,8 @@ check_privilege(const char *privilege)
 
     fp = fopen(label_path, "r");
     if (fp != NULL) {
-        if (fread(smack_label, 1, sizeof(smack_label) - 1, fp) <= 0) {
+        num = fread(smack_label, 1, sizeof(smack_label) - 1, fp);
+        if (num <= 0) {
             LOGW("[check_privilege] fail to fread");
         }
         fclose(fp);