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, static tKFWUM_Status KfwumGetFileSize(unsigned char *pFileName,
unsigned long *pFileSize) unsigned long *pFileSize)
{ {
tKFWUM_Status status = KFWUM_STATUS_ERROR; FILE *pFileHandle = NULL;
FILE * pFileHandle;
pFileHandle = fopen((const char *)pFileName, "rb"); pFileHandle = fopen((const char *)pFileName, "rb");
if (pFileHandle == NULL) {
if(pFileHandle) return KFWUM_STATUS_ERROR;
{
if (fseek(pFileHandle, 0L , SEEK_END) == 0)
{
*pFileSize = ftell(pFileHandle);
if( *pFileSize != 0)
{
status = KFWUM_STATUS_OK;
} }
if (fseek(pFileHandle, 0L , SEEK_END) == 0) {
*pFileSize = ftell(pFileHandle);
} }
fclose(pFileHandle); fclose(pFileHandle);
if (*pFileSize != 0) {
return KFWUM_STATUS_OK;
} }
return KFWUM_STATUS_ERROR;
return(status);
} }
/* KfwumSetupBuffersFromFile - small buffers are used to store the file data /* KfwumSetupBuffersFromFile - small buffers are used to store the file data