From 32b3eb6bd8510126d98603cac7c97dd3bfa863a3 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sat, 14 Dec 2019 10:40:52 +0100 Subject: [PATCH] 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. Signed-off-by: Anuj Jain Signed-off-by: Ayush Garg --- 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 17bf2c0..df6e3f0 100644 --- a/src/shared/mainloop-notify.c +++ b/src/shared/mainloop-notify.c @@ -90,7 +90,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.7.4