From: Suyeon Hwang Date: Fri, 13 Oct 2017 06:31:03 +0000 (+0900) Subject: Fix error check for fread X-Git-Tag: accepted/tizen/unified/20180305.062850~18 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fstt.git;a=commitdiff_plain;h=43ab129d278ae4fe372f4f86e299b9f92bb126a9 Fix error check for fread Change-Id: I010446098278d180cf8b546123bb9790d48395e9 Signed-off-by: Suyeon Hwang --- 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; }