From 16dab0bd55b7d4fe74ef58a0f62ba0264e14039b Mon Sep 17 00:00:00 2001 From: Wonnam Jang Date: Thu, 12 Apr 2018 20:27:49 +0900 Subject: [PATCH] Correct to check return of fread Change-Id: I2be0a615a5a5052f56c1c4958f9575033c952b38 Signed-off-by: Wonnam Jang --- client/vc.c | 2 +- common/vc_command.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/vc.c b/client/vc.c index 9cfc04b..b3c9b24 100644 --- a/client/vc.c +++ b/client/vc.c @@ -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); diff --git a/common/vc_command.c b/common/vc_command.c index 77e363b..282f9a4 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -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); -- 2.7.4