On Mon, Oct 31, 2022 at 08:56:48AM -0500, Eric Blake wrote:
On Thu, Oct 27, 2022 at 09:49:52AM +0100, Richard W.M. Jones wrote:
On Wed, Oct 26, 2022 at 05:18:00PM -0500, Eric Blake wrote:
- if (conn->sockin >= 0) - closesocket (conn->sockin); - if (conn->sockout >= 0 && conn->sockin != conn->sockout) - closesocket (conn->sockout); + if (conn->sockout >= 0 && how == SHUT_WR) { + if (conn->sockin == conn->sockout) + shutdown (conn->sockout, how); + else + closesocket (conn->sockout); + conn->sockout = -1;
Don't we leak conn->sockin, if how == SHUT_WR && conn->sockin == conn->sockout?
No, because any call with how==SHUT_WR will eventually be followed by another call with how==SHUT_RDWR, and it is the latter call which handles closing sockin.
Got it, OK. Series looks fine in that case. Rich.
Rich.
+ } + else { + if (conn->sockin >= 0) + closesocket (conn->sockin); + if (conn->sockout >= 0 && conn->sockin != conn->sockout) + closesocket (conn->sockout); + } }
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html