missing close in Socket::operator = #470

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

Projects

None yet

2 participants

@ibukanov

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 ibukanov added a commit to ibukanov/mosh that referenced this issue Oct 26, 2013
@ibukanov ibukanov issue #470 - close old socket before its is overwritten before assign…
…ment.

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.
c7bd63b
@keithw keithw added a commit that closed this issue Jan 4, 2014
@keithw keithw network.cc: Properly close old fd on Socket assignment operator
Fix thanks to Igor Bukanov. Closes #470.
2767894
@keithw keithw closed this in 2767894 Jan 4, 2014
@keithw
Mosh (mobile shell) member

Nice catch, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment