handle empty fread to avoid -Wunused-result

This commit is contained in:
Mészáros Mihály 2018-12-07 15:08:43 +01:00
parent 3c43da83f3
commit d3263954ae

View File

@ -1868,7 +1868,9 @@ static int adminmain(int argc, char **argv)
}
else{
fseek (fptr, 0, SEEK_SET);
fread (generated_key, sizeof(char), 16, fptr);
if( fread(generated_key, sizeof(char), 16, fptr) !=0 ){
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: ERROR: Secret-Key file is empty\n",__FUNCTION__);
}
fclose (fptr);
}
break;
@ -2900,7 +2902,9 @@ static void set_ctx(SSL_CTX** out, const char *protocol, const SSL_METHOD* metho
perror("Cannot open Secret-Key file");
} else {
fseek (f, 0, SEEK_SET);
fread (turn_params.secret_key, sizeof(char), 16, f);
if ( fread(turn_params.secret_key, sizeof(char), 16, f) != 0 ){
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: ERROR: Secret-Key file is empty\n",__FUNCTION__);
}
fclose (f);
}
}