From 43ab129d278ae4fe372f4f86e299b9f92bb126a9 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Fri, 13 Oct 2017 15:31:03 +0900 Subject: [PATCH] Fix error check for fread Change-Id: I010446098278d180cf8b546123bb9790d48395e9 Signed-off-by: Suyeon Hwang --- client/stt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/stt.c b/client/stt.c index a986912..2035dea 100644 --- a/client/stt.c +++ b/client/stt.c @@ -100,15 +100,15 @@ static bool __check_privilege(const char* uid, const char * privilege) char smack_label[1024] = {'\0',}; if (!p_cynara) { - return false; + return false; } fp = fopen(label_path, "r"); if (fp != NULL) { - if (fread(smack_label, 1, sizeof(smack_label), fp) <= 0) - SLOG(LOG_ERROR, TAG_STTC, "[ERROR] fail to fread"); + if (sizeof(smack_label) != fread(smack_label, 1, sizeof(smack_label), fp)) + SLOG(LOG_ERROR, TAG_STTC, "[ERROR] fail to fread"); - fclose(fp); + fclose(fp); } pid_t pid = getpid(); @@ -121,7 +121,7 @@ static bool __check_privilege(const char* uid, const char * privilege) } if (ret != CYNARA_API_ACCESS_ALLOWED) - return false; + return false; return true; } -- 2.7.4