diff options
author | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2020-10-22 22:16:20 +0000 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2020-10-26 06:56:56 +0000 |
commit | 3a7825983c506d5a521862bfa5700a87c525227d (patch) | |
tree | df7c0bb5cc80deb33af60e342eb8e501158dd3a2 /util | |
parent | 9d50efe19dad26eba3285c3295b804490b81b0e7 (diff) |
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>
Diffstat (limited to 'util')
-rw-r--r-- | util/ectool/ec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/util/ectool/ec.c b/util/ectool/ec.c index f30d12f976..a189a094b5 100644 --- a/util/ectool/ec.c +++ b/util/ectool/ec.c @@ -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); |