diff options
author | Tom Cherry <tomcherry@google.com> | 2017-03-20 14:24:25 -0700 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2017-03-20 14:40:02 -0700 |
commit | 40578ab91f48f0654ca71cd147d0ab9359478b4b (patch) | |
tree | 583097d33d076e76c9e6eeaea613bb625e420288 /libunwindstack/tests/MemoryFileTest.cpp | |
parent | 5a258e72febb9c9aa8634a342759b30013a53d10 (diff) |
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
Diffstat (limited to 'libunwindstack/tests/MemoryFileTest.cpp')
0 files changed, 0 insertions, 0 deletions