Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing close in Socket::operator = #470

Closed
ibukanov opened this issue Oct 26, 2013 · 1 comment
Closed

missing close in Socket::operator = #470

ibukanov opened this issue Oct 26, 2013 · 1 comment

Comments

@ibukanov
Copy link
Contributor

Socket::operator = https://github.com/keithw/mosh/blob/master/src/network/network.cc#L592 does not close the current socket before dupping another one.

I suppose the bug is inconsequential as the usage of Socket never triggers calls to the assignment operator, but this is fragile.

ibukanov added a commit to ibukanov/mosh that referenced this issue Oct 26, 2013
…efore assignment.

The patch also changes socket copy constructor and assignment of Socket to simply clear the _fd field in the copy source to avoid the need for calling dup - move semantic fot _fd is sufficient.
@keithw keithw closed this as completed in 2767894 Jan 4, 2014
@keithw
Copy link
Member

keithw commented Jan 4, 2014

Nice catch, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants