[sanitizer] Fix error checking in ThreadLister

llvm-svn: 331735
This commit is contained in:
Vitaly Buka 2018-05-08 04:56:57 +00:00
parent 47db4e6e5b
commit 4199dbd633
1 changed files with 3 additions and 2 deletions

View File

@ -917,7 +917,8 @@ ThreadLister::ThreadLister(int pid) : pid_(pid), buffer_(4096) {
}
bool ThreadLister::ListThreads(InternalMmapVector<int> *threads) {
if (!descriptor_) return false;
if (internal_iserror(descriptor_))
return false;
internal_lseek(descriptor_, 0, SEEK_SET);
threads->clear();
@ -942,7 +943,7 @@ bool ThreadLister::ListThreads(InternalMmapVector<int> *threads) {
}
ThreadLister::~ThreadLister() {
if (descriptor_ >= 0)
if (!internal_iserror(descriptor_))
internal_close(descriptor_);
}