init: Fix leaking fd and error print
read_file() does not close its fd if either stat() fails or the file has group/world writable permissions. Use unique_fd to ensure that all return paths close the fd and make the same change to write_file() for consistency. Replace PLOG() with LOG() after a simple if conditional, that does not set errno. Old: init: skipping insecure file '/data/bootchart/header': No such device or address New: init: skipping insecure file '/data/bootchart/header' Test: Cause an invalid file read and check the error log Test: Ensure non-error read_file() and write_file() work Change-Id: Ib15d94e38362e335d671d30b36aa5605254ec7ab
Loading
Please register or sign in to comment