1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-26 16:45:12 -04:00

[leds] Check return value of fscanf

This commit is contained in:
Witold Filipczyk 2022-06-24 22:03:07 +02:00
parent ad646029e3
commit 32afb683f2

View File

@ -217,6 +217,7 @@ draw_temperature_node(struct session *ses, int xpos, int ypos, unsigned int node
struct terminal *term = ses->tab->term;
FILE *f;
int temp = 0;
int ret;
struct string text;
int i;
int length;
@ -224,9 +225,16 @@ draw_temperature_node(struct session *ses, int xpos, int ypos, unsigned int node
f = fopen(get_leds_temperature_filename(), "r");
if (!f) return 0;
fscanf(f, "%d", &temp);
if (!f) {
return 0;
}
ret = fscanf(f, "%d", &temp);
fclose(f);
if (ret < 1) {
return 0;
}
if (!init_string(&text)) {
return 0;
}