ectool: Don't ignore fgets return code

Change-Id: I12dc449e06dee31b4b0811ab23c6e8635cf31512
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/46667
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Stefan Reinauer 2020-10-22 22:16:20 +00:00 committed by Patrick Georgi
parent 9d50efe19d
commit 3a7825983c
1 changed files with 4 additions and 1 deletions

View File

@ -167,7 +167,10 @@ int get_ec_ports(void)
return -1;
while (!feof(fp) && (data == 0 || cmd == 0)) {
fgets(line, sizeof(line), fp);
if (fgets(line, sizeof(line), fp) == NULL) {
fprintf(stderr, "Can not read from /proc/ioports.\n");
break;
}
if (strstr(line, "EC data") != NULL)
data = strtol(line, NULL, 16);