Package: bluez
Version: 5.52-1
Severity: serious

Hi!

This package got a custom reimplementation of the libsystemd sd_notify
support in the experimental version, but it incorrectly uses bind(2)
instead of connect(2) on the notification socket, so when using a
non-abstract Unix socket, we get an “address already used” error from
bind(2). We are the client so using bind(2) is just wrong here. This
breaks with dpkg's start-stop-daemon which does not use abstract Unix
sockets.

I'm attaching a patch fixing this, which I've also sent upstream.

Thanks,
Guillem
From 407983890dc925e692fe21912b8ed82dcb0c96b4 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guil...@hadrons.org>
Date: Sat, 14 Dec 2019 10:28:56 +0100
Subject: [PATCH BlueZ] shared/mainloop: Use connect() instead of bind() for
 sd_notify

We are the client, so we should be using connect(2) instead of bind(2),
otherwise when using non-abstract Unix sockets we will get an error that
the address is already in use.

This breaks the notify support in dpkg's start-stop-daemon.
---
 src/shared/mainloop-notify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/shared/mainloop-notify.c b/src/shared/mainloop-notify.c
index 89a880006..1de714a0e 100644
--- a/src/shared/mainloop-notify.c
+++ b/src/shared/mainloop-notify.c
@@ -91,7 +91,7 @@ void mainloop_notify_init(void)
 	if (addr.sun_path[0] == '@')
 		addr.sun_path[0] = '\0';
 
-	if (bind(notify_fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
+	if (connect(notify_fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
 		close(notify_fd);
 		notify_fd = -1;
 		return;
-- 
2.24.1.658.g99f4b37f93

Reply via email to