Avoid double close in delete_dir_contents.
fdopendir takes ownership of the file descriptor, leading to it being closed by both unique_fd's destructor and closedir. Test: treehugger Change-Id: Ibd193e988c77c5323720531445f334c0795c68b9
This commit is contained in:
parent
298fa3264f
commit
e3c32e0d2f
1 changed files with 2 additions and 1 deletions
|
@ -818,7 +818,8 @@ static status_t delete_dir_contents(DIR* dir) {
|
|||
result = -errno;
|
||||
continue;
|
||||
}
|
||||
std::unique_ptr<DIR, decltype(&closedir)> subdirp(fdopendir(subfd), closedir);
|
||||
std::unique_ptr<DIR, decltype(&closedir)> subdirp(
|
||||
android::base::Fdopendir(std::move(subfd)), closedir);
|
||||
if (!subdirp) {
|
||||
PLOG(ERROR) << "Couldn't fdopendir " << name;
|
||||
result = -errno;
|
||||
|
|
Loading…
Reference in a new issue