mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 18:47:22 +00:00
ID: 46 - ipmi_fwum needs some re-work
KfwumGetFileSize() - small re-work
This commit is contained in:
parent
2b08fd405e
commit
52634a708f
@ -398,29 +398,22 @@ static void KfwumMain(struct ipmi_intf * intf, tKFWUM_Task task)
|
|||||||
*
|
*
|
||||||
* returns KFWUM_STATUS_OK or KFWUM_STATUS_ERROR
|
* returns KFWUM_STATUS_OK or KFWUM_STATUS_ERROR
|
||||||
*/
|
*/
|
||||||
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");
|
||||||
|
if (pFileHandle == NULL) {
|
||||||
pFileHandle = fopen((const char *)pFileName, "rb");
|
return KFWUM_STATUS_ERROR;
|
||||||
|
}
|
||||||
if(pFileHandle)
|
if (fseek(pFileHandle, 0L , SEEK_END) == 0) {
|
||||||
{
|
*pFileSize = ftell(pFileHandle);
|
||||||
if (fseek(pFileHandle, 0L , SEEK_END) == 0)
|
}
|
||||||
{
|
fclose(pFileHandle);
|
||||||
*pFileSize = ftell(pFileHandle);
|
if (*pFileSize != 0) {
|
||||||
|
return KFWUM_STATUS_OK;
|
||||||
if( *pFileSize != 0)
|
}
|
||||||
{
|
return KFWUM_STATUS_ERROR;
|
||||||
status = KFWUM_STATUS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(pFileHandle);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* KfwumSetupBuffersFromFile - small buffers are used to store the file data
|
/* KfwumSetupBuffersFromFile - small buffers are used to store the file data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user