This is an archive of the discontinued LLVM Phabricator instance.

[LLDB][NFC] Reliability fixes to TCPSocket code
ClosedPublic

Authored by fixathon on Aug 5 2022, 2:02 PM.

Details

Summary

Patch the following issues found by static code inspection:

  • Unchecked return values from lib calls
  • Passing potentially negative arg into a function that requires non-negative input
  • Possible socket double-close

Diff Detail

Event Timeline

fixathon created this revision.Aug 5 2022, 2:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 5 2022, 2:02 PM
fixathon requested review of this revision.Aug 5 2022, 2:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 5 2022, 2:02 PM

Not that my opinion means much, but the changes look good to me.

jasonmolenda accepted this revision.Aug 6 2022, 11:04 PM
jasonmolenda added a subscriber: jasonmolenda.

LGTM.

This revision is now accepted and ready to land.Aug 6 2022, 11:04 PM
This revision was automatically updated to reflect the committed changes.

We don't use the constant first so you don't accidentally use "=" rather than "==" convention anywhere else in lldb, so it looks weird here.

fixathon added a comment.EditedAug 8 2022, 10:16 AM

We don't use the constant first so you don't accidentally use "=" rather than "==" convention anywhere else in lldb, so it looks weird here.

Good feedback. I'll switch that around.

On second thought, this very file has numerous instances of "constant first" style, ex: (-1 == expression), so this is consistent with the current style of this file. Would you still like the style adjusted?

Commented on feedback.