Correct to check return of fread 10/175810/2
authorWonnam Jang <wn.jang@samsung.com>
Thu, 12 Apr 2018 11:27:49 +0000 (20:27 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Thu, 12 Apr 2018 11:31:27 +0000 (20:31 +0900)
Change-Id: I2be0a615a5a5052f56c1c4958f9575033c952b38
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
client/vc.c
common/vc_command.c

index 9cfc04b..b3c9b24 100644 (file)
@@ -110,7 +110,7 @@ static int __check_privilege(const char* uid, const char * privilege)
 
        fp = fopen(label_path, "r");
        if (fp != NULL) {
-               if (strlen(smack_label) != fread(smack_label, 1, sizeof(smack_label), fp))
+               if (0 >= fread(smack_label, 1, sizeof(smack_label), fp))
                        SLOG(LOG_ERROR, TAG_VCC, "[ERROR] fail to fread");
 
                fclose(fp);
index 77e363b..282f9a4 100644 (file)
@@ -102,7 +102,7 @@ static int __check_privilege(const char* uid, const char * privilege)
 
        fp = fopen(label_path, "r");
        if (fp != NULL) {
-               if (sizeof(smack_label) != fread(smack_label, 1, sizeof(smack_label), fp))
+               if (0 >= fread(smack_label, 1, sizeof(smack_label), fp))
                        SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] fail to fread");
 
                fclose(fp);