aboutsummaryrefslogtreecommitdiff
path: root/util/ectool/ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/ectool/ec.c')
-rw-r--r--util/ectool/ec.c5
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);