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
Check return values of scanf() in order to get rid off compiler warnings. Commit for Dan Gora
This commit is contained in:
parent
157132be8c
commit
aebc7d3616
@ -1542,24 +1542,31 @@ fru_area_print_multirec(struct ipmi_intf * intf, struct fru_info * fru,
|
|||||||
int ipmi_fru_query_new_value(uint8_t *data,int offset, size_t len)
|
int ipmi_fru_query_new_value(uint8_t *data,int offset, size_t len)
|
||||||
{
|
{
|
||||||
int status=FALSE;
|
int status=FALSE;
|
||||||
|
int ret;
|
||||||
char answer;
|
char answer;
|
||||||
|
|
||||||
|
|
||||||
printf("Would you like to change this value <y/n> ? ");
|
printf("Would you like to change this value <y/n> ? ");
|
||||||
|
ret = scanf("%c", &answer);
|
||||||
scanf("%c",&answer);
|
if (ret != 1) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if( answer == 'y' || answer == 'Y' ){
|
if( answer == 'y' || answer == 'Y' ){
|
||||||
int i;
|
int i;
|
||||||
unsigned int *holder;
|
unsigned int *holder;
|
||||||
|
|
||||||
holder = malloc(len);
|
holder = malloc(len);
|
||||||
printf("Enter hex values for each of the %d entries (lsb first)," \
|
printf(
|
||||||
" hit <enter> between entries\n",len);
|
"Enter hex values for each of the %d entries (lsb first), "
|
||||||
|
"hit <enter> between entries\n", (int)len);
|
||||||
|
|
||||||
/* I can't assign scanf' %x into a single char */
|
/* I can't assign scanf' %x into a single char */
|
||||||
for( i=0;i<len;i++ ){
|
for( i=0;i<len;i++ ){
|
||||||
scanf("%x",holder+i);
|
ret = scanf("%x", holder+i);
|
||||||
|
if (ret != 1) {
|
||||||
|
free(holder);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for( i=0;i<len;i++ ){
|
for( i=0;i<len;i++ ){
|
||||||
data[offset++] = (unsigned char) *(holder+i);
|
data[offset++] = (unsigned char) *(holder+i);
|
||||||
|
@ -1103,8 +1103,14 @@ static int HpmFwupgActionUploadFirmware
|
|||||||
int HpmGetUserInput(char *str)
|
int HpmGetUserInput(char *str)
|
||||||
{
|
{
|
||||||
char userInput[2];
|
char userInput[2];
|
||||||
|
int ret;
|
||||||
|
|
||||||
printf("%s", str);
|
printf("%s", str);
|
||||||
scanf("%s",userInput);
|
ret = scanf("%s", userInput);
|
||||||
|
if (!ret) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (toupper(userInput[0]) == 'Y')
|
if (toupper(userInput[0]) == 'Y')
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user