This is an archive of the discontinued LLVM Phabricator instance.

bugfix: File::GetWaitableHandle() should call fileno()
ClosedPublic

Authored by lawrence_danna on Sep 19 2019, 9:12 PM.

Details

Summary

If the file has m_stream, it may not have a m_descriptor.
GetWaitableHandle() should call GetDescriptor(), which will call
fileno(), so it will get waitable descriptor whenever one is available.

Event Timeline

lawrence_danna created this revision.Sep 19 2019, 9:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2019, 9:12 PM
labath added a subscriber: labath.Sep 20 2019, 5:20 AM

Thanks for the fix. This sounds like it should be unit testable. Could add a test for that?

added a unit test

labath accepted this revision.Sep 23 2019, 12:43 AM

Thanks for adding the test. LGTM, modulo some nits inline.

lldb/unittests/Host/CMakeLists.txt
14 ↗(On Diff #221082)

Please keep the list sorted.

lldb/unittests/Host/FileTest.cpp
29–32 ↗(On Diff #221082)

nit: change EXPECT_XXX to ASSERT_XXX as it does not make sense to continue the test if the assertions are not true.

This revision is now accepted and ready to land.Sep 23 2019, 12:43 AM
lawrence_danna marked 2 inline comments as done.Sep 23 2019, 12:20 PM

nits fixed

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptSep 23 2019, 12:32 PM