summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--init/init.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/init/init.cpp b/init/init.cpp
index 58d7d34..8ea42ca 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -1012,8 +1012,10 @@ static int charging_mode_booting(void) {
if (f < 0)
return 0;
- if (1 != read(f, (void *)&cmb,1))
+ if (1 != read(f, (void *)&cmb,1)) {
+ close(f);
return 0;
+ }
close(f);
return ('1' == cmb);