This is an archive of the discontinued LLVM Phabricator instance.

Fix setting of success in Socket::Close()
ClosedPublic

Authored by shafik on Jan 6 2022, 2:34 PM.

Details

Summary

Both close and closesocket should return 0 on success so using !! looks incorrect. I replaced this will a more readable == 0 check.

Diff Detail

Event Timeline

shafik requested review of this revision.Jan 6 2022, 2:34 PM
shafik created this revision.

AFAICT this fix is correct but I am not sure how to verify of test it. I ran the test suite and it passed but that does not mean this is being covered.

labath accepted this revision.Jan 6 2022, 11:58 PM

Usually, the only thing one can do if a close fails is to log an error message, so it's not completely surprising that this has gone by unnoticed.

It might be nice to insert a close call to one of the existing Socket unit tests (or add a new one), but other than that, I am pretty sure this is fine.

This revision is now accepted and ready to land.Jan 6 2022, 11:58 PM
JDevlieghere accepted this revision.Jan 7 2022, 9:17 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJan 7 2022, 12:43 PM