• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/corennnnn


Commit MetaInfo

修訂f422f00e56c3d2cdebfdbfaba0781e28e13f31a5 (tree)
時間2016-11-14 03:14:49
作者Michael W <baddaemon87@gmai...>
CommiterLuca Stefani

Log Message

init: Fix possible open file pointer

In error case the file is not closed properly.
Add close() before return

Change-Id: Ie1755987859a576045c786105404957d94f0b39d
(cherry picked from commit 656154a5b4127370f7317852e224a9121c6beed3)

Change Summary

差異

--- a/init/init.cpp
+++ b/init/init.cpp
@@ -541,8 +541,10 @@ static int charging_mode_booting(void) {
541541 if (f < 0)
542542 return 0;
543543
544- if (1 != read(f, (void *)&cmb,1))
544+ if (1 != read(f, (void *)&cmb,1)) {
545+ close(f);
545546 return 0;
547+ }
546548
547549 close(f);
548550 return ('1' == cmb);