From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDWX7-0007u7-5y for qemu-devel@nongnu.org; Thu, 16 Jun 2016 08:36:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDWX3-00030N-5m for qemu-devel@nongnu.org; Thu, 16 Jun 2016 08:36:29 -0400 Received: from mx6-phx2.redhat.com ([209.132.183.39]:38961) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDWX2-000302-Th for qemu-devel@nongnu.org; Thu, 16 Jun 2016 08:36:25 -0400 Date: Thu, 16 Jun 2016 08:36:23 -0400 (EDT) From: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Message-ID: <1856689929.7038707.1466080583328.JavaMail.zimbra@redhat.com> In-Reply-To: References: <1466075835-28494-1-git-send-email-marcandre.lureau@redhat.com> <1466075835-28494-4-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/3] socket: unlink unix socket on remove List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: marcandre lureau , qemu-devel@nongnu.org, berrange@redhat.com Hi ----- Original Message ----- >=20 >=20 > On 16/06/2016 13:17, marcandre.lureau@redhat.com wrote: > > From: Marc-Andr=C3=A9 Lureau > >=20 > > qemu leaves unix socket files behind when removing a listening chardev > > or leaving. qemu could clean that up, even if doing so isn't race-free. > >=20 > > Fixes: > > https://bugzilla.redhat.com/show_bug.cgi?id=3D1347077 > >=20 > > Signed-off-by: Marc-Andr=C3=A9 Lureau > > --- > > include/qemu/sockets.h | 1 + > > io/channel-socket.c | 10 ++++++++++ > > tests/test-io-channel-socket.c | 2 +- > > util/qemu-sockets.c | 18 ++++++++++++++++++ > > 4 files changed, 30 insertions(+), 1 deletion(-) > >=20 > > diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h > > index 1bd9218..5dd2648 100644 > > --- a/include/qemu/sockets.h > > +++ b/include/qemu/sockets.h > > @@ -51,6 +51,7 @@ SocketAddress *socket_parse(const char *str, Error > > **errp); > > int socket_connect(SocketAddress *addr, Error **errp, > > NonBlockingConnectHandler *callback, void *opaque); > > int socket_listen(SocketAddress *addr, Error **errp); > > +void socket_listen_cleanup(int fd, Error **errp); > > int socket_dgram(SocketAddress *remote, SocketAddress *local, Error > > **errp); > > =20 > > /* Old, ipv4 only bits. Don't use for new code. */ > > diff --git a/io/channel-socket.c b/io/channel-socket.c > > index 1cd5848..319e1ab 100644 > > --- a/io/channel-socket.c > > +++ b/io/channel-socket.c > > @@ -400,7 +400,17 @@ static void qio_channel_socket_init(Object *obj) > > static void qio_channel_socket_finalize(Object *obj) > > { > > QIOChannelSocket *ioc =3D QIO_CHANNEL_SOCKET(obj); > > + > > if (ioc->fd !=3D -1) { > > + Error *err =3D NULL; > > + > > + if (QIO_CHANNEL(ioc)->features & QIO_CHANNEL_FEATURE_LISTEN) > > + socket_listen_cleanup(ioc->fd, &err); >=20 > Every time you forget braces, checkpatch.pl kills a kitten! Think of > the kittens! Oh no! :) (weird the git hook usually catch this for me), fixed