ID: 46 - ipmi_fwum needs some re-work

KfwumGetFileSize() - small re-work
This commit is contained in:
Zdenek Styblik 2013-10-26 18:37:45 +00:00
parent 2b08fd405e
commit 52634a708f

View File

@ -401,26 +401,19 @@ static void KfwumMain(struct ipmi_intf * intf, tKFWUM_Task task)
static tKFWUM_Status KfwumGetFileSize(unsigned char *pFileName,
unsigned long *pFileSize)
{
tKFWUM_Status status = KFWUM_STATUS_ERROR;
FILE * pFileHandle;
FILE *pFileHandle = NULL;
pFileHandle = fopen((const char *)pFileName, "rb");
if(pFileHandle)
{
if (fseek(pFileHandle, 0L , SEEK_END) == 0)
{
*pFileSize = ftell(pFileHandle);
if( *pFileSize != 0)
{
status = KFWUM_STATUS_OK;
if (pFileHandle == NULL) {
return KFWUM_STATUS_ERROR;
}
if (fseek(pFileHandle, 0L , SEEK_END) == 0) {
*pFileSize = ftell(pFileHandle);
}
fclose(pFileHandle);
if (*pFileSize != 0) {
return KFWUM_STATUS_OK;
}
return(status);
return KFWUM_STATUS_ERROR;
}
/* KfwumSetupBuffersFromFile - small buffers are used to store the file data