Commit fa182f2d authored by Adam Wujek's avatar Adam Wujek 💬

userspace/snmpd: try again next time when read error from file

Try again when read error from file
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 494ae10c
......@@ -285,12 +285,18 @@ static void get_boot_scripts_status(void){
if (!strncmp(buff, "hwinfo_ok", 20))
wrsBootStatus_s.wrsBootHwinfoReadout =
WRS_BOOT_HWINFO_OK;
else if (!strncmp(buff, "hwinfo_warning", 20))
else if (!strncmp(buff, "hwinfo_warning", 20)) {
wrsBootStatus_s.wrsBootHwinfoReadout =
WRS_BOOT_HWINFO_WARNING;
else /* */
/* try again next time */
run_once = 0;
}
else {/* */
wrsBootStatus_s.wrsBootHwinfoReadout =
WRS_BOOT_HWINFO_ERROR;
/* try again next time */
run_once = 0;
}
} else {
/* status file not found, probably something else caused
* a problem */
......@@ -309,12 +315,19 @@ static void get_boot_scripts_status(void){
if (!strncmp(buff, "load_ok", 20))
wrsBootStatus_s.wrsBootLoadFPGA =
WRS_BOOT_LOAD_FPGA_OK;
else if (!strncmp(buff, "load_file_not_found", 20))
else if (!strncmp(buff, "load_file_not_found", 20)) {
wrsBootStatus_s.wrsBootLoadFPGA =
WRS_BOOT_LOAD_FPGA_FILE_NOT_FOUND;
else /* */
/* try again next time */
run_once = 0;
}
else {/* */
wrsBootStatus_s.wrsBootLoadFPGA =
WRS_BOOT_LOAD_FPGA_ERROR;
/* try again next time */
run_once = 0;
}
} else {
/* status file not found, probably something else caused
* a problem */
......@@ -333,12 +346,19 @@ static void get_boot_scripts_status(void){
if (!strncmp(buff, "load_ok", 20))
wrsBootStatus_s.wrsBootLoadLM32 =
WRS_BOOT_LOAD_LM32_OK;
else if (!strncmp(buff, "load_file_not_found", 20))
else if (!strncmp(buff, "load_file_not_found", 20)) {
wrsBootStatus_s.wrsBootLoadLM32 =
WRS_BOOT_LOAD_LM32_FILE_NOT_FOUND;
else /* */
/* try again next time */
run_once = 0;
}
else {/* */
wrsBootStatus_s.wrsBootLoadLM32 =
WRS_BOOT_LOAD_LM32_ERROR;
/* try again next time */
run_once = 0;
}
} else {
/* status file not found, probably something else caused
* a problem */
......
......@@ -103,8 +103,11 @@ time_t wrsVersion_data_fill(void)
guess_index = 0;
while (fgets(s, sizeof(s), f)) {
if (sscanf(s, "%s %[^\n]", key, value) != 2)
if (sscanf(s, "%s %[^\n]", key, value) != 2) {
/* try again next time */
run_once = 0;
continue; /* error... */
}
/* try educated guess to find position in array */
if (!strcmp(key, wrs_version[guess_index].key)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment