mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 10:37:22 +00:00
ID: 65 - Fixes for configure.in for cross compilation
Changes to ipmi_ekanalyzer_fru_file2structure() in order to get rid off warnings. Commit for Dan Gora
This commit is contained in:
parent
04ba23bc5d
commit
8b7969a46f
@ -4027,6 +4027,7 @@ ipmi_ekanalyzer_fru_file2structure(char * filename,
|
|||||||
unsigned char last_record = 0;
|
unsigned char last_record = 0;
|
||||||
unsigned int multi_offset = 0;
|
unsigned int multi_offset = 0;
|
||||||
int record_count = 0;
|
int record_count = 0;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
input_file = fopen(filename, "r");
|
input_file = fopen(filename, "r");
|
||||||
if (input_file == NULL) {
|
if (input_file == NULL) {
|
||||||
@ -4035,22 +4036,32 @@ ipmi_ekanalyzer_fru_file2structure(char * filename,
|
|||||||
}
|
}
|
||||||
|
|
||||||
fseek(input_file, START_DATA_OFFSET, SEEK_SET);
|
fseek(input_file, START_DATA_OFFSET, SEEK_SET);
|
||||||
fread(&data, 1, 1, input_file);
|
data = 0;
|
||||||
if (data < 1) {
|
ret = fread(&data, 1, 1, input_file);
|
||||||
lprintf(LOG_NOTICE, "There is no multi record in the file %s\n",
|
if ((ret != 1) || ferror(input_file)) {
|
||||||
|
lprintf(LOG_ERR, "Invalid Offset!");
|
||||||
|
return ERROR_STATUS;
|
||||||
|
}
|
||||||
|
if (data == 0) {
|
||||||
|
lprintf(LOG_ERR, "There is no multi record in the file '%s'",
|
||||||
filename);
|
filename);
|
||||||
fclose(input_file);
|
fclose(input_file);
|
||||||
return ERROR_STATUS;
|
return ERROR_STATUS;
|
||||||
}
|
}
|
||||||
/* the offset value is in multiple of 8 bytes. */
|
/* the offset value is in multiple of 8 bytes. */
|
||||||
multi_offset = data * 8;
|
multi_offset = data * 8;
|
||||||
if (verbose == LOG_DEBUG) {
|
lprintf(LOG_DEBUG, "start multi offset = 0x%02x",
|
||||||
printf("start multi offset = 0x%02lx\n", multi_offset);
|
multi_offset );
|
||||||
}
|
|
||||||
fseek(input_file, multi_offset, SEEK_SET);
|
fseek(input_file, multi_offset, SEEK_SET);
|
||||||
while (!feof(input_file)) {
|
while (!feof(input_file)) {
|
||||||
*list_record = malloc(sizeof(struct ipmi_ek_multi_header));
|
*list_record = malloc(sizeof(struct ipmi_ek_multi_header));
|
||||||
fread(&(*list_record)->header, START_DATA_OFFSET, 1, input_file);
|
ret = fread(&(*list_record)->header, START_DATA_OFFSET, 1,
|
||||||
|
input_file);
|
||||||
|
if ((ret != 1) || ferror(input_file)) {
|
||||||
|
lprintf(LOG_ERR, "Invalid Header!");
|
||||||
|
return ERROR_STATUS;
|
||||||
|
}
|
||||||
if ((*list_record)->header.len == 0) {
|
if ((*list_record)->header.len == 0) {
|
||||||
record_count++;
|
record_count++;
|
||||||
continue;
|
continue;
|
||||||
@ -4063,12 +4074,15 @@ ipmi_ekanalyzer_fru_file2structure(char * filename,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
fread((*list_record)->data, ((*list_record)->header.len), 1,
|
ret = fread((*list_record)->data, ((*list_record)->header.len),
|
||||||
input_file);
|
1, input_file);
|
||||||
if (verbose > 0) {
|
if ((ret != 1) || ferror(input_file)) {
|
||||||
|
lprintf(LOG_ERR, "Invalid Record Data!");
|
||||||
|
return ERROR_STATUS;
|
||||||
|
}
|
||||||
|
if (verbose > 0)
|
||||||
printf("Record %d has length = %02x\n", record_count,
|
printf("Record %d has length = %02x\n", record_count,
|
||||||
(*list_record)->header.len);
|
(*list_record)->header.len);
|
||||||
}
|
|
||||||
if (verbose > 1) {
|
if (verbose > 1) {
|
||||||
int i;
|
int i;
|
||||||
printf("Type: %02x", (*list_record)->header.type);
|
printf("Type: %02x", (*list_record)->header.type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user