Based on 6b9732b2bf0499c5e4ea8a9d4f6051d98033f680 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 3 Mar 2014 19:49:40 -0500
Subject: [PATCH] Be more verbose when bind or listen fails

Also be more verbose in devnode_acl_all().
---
 src/core/manager.c            |    2 +-
 src/journal/journald-native.c |    2 +-
 src/journal/journald-stream.c |    4 ++--
 src/journal/journald-syslog.c |    2 +-
 src/login/logind-acl.c        |    5 ++++-
 src/shared/ask-password-api.c |    2 +-
 6 files changed, 10 insertions(+), 7 deletions(-)

--- src/core/manager.c
+++ src/core/manager.c	2014-07-21 10:57:20.286367050 +0000
@@ -571,7 +571,7 @@ static int manager_setup_notify(Manager
 
                 r = bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sa.un.sun_path+1));
                 if (r < 0) {
-                        log_error("bind() failed: %m");
+                        log_error("bind(@%s) failed: %m", sa.un.sun_path+1);
                         return -errno;
                 }
 
--- src/journal/journald-native.c
+++ src/journal/journald-native.c	2014-07-21 00:00:00.000000000 +0000
@@ -405,7 +405,7 @@ int server_open_native_socket(Server*s)
 
                 r = bind(s->native_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
                 if (r < 0) {
-                        log_error("bind() failed: %m");
+                        log_error("bind(%s) failed: %m", sa.un.sun_path);
                         return -errno;
                 }
 
--- src/journal/journald-stream.c
+++ src/journal/journald-stream.c	2014-07-21 00:00:00.000000000 +0000
@@ -447,14 +447,14 @@ int server_open_stdout_socket(Server *s)
 
                 r = bind(s->stdout_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
                 if (r < 0) {
-                        log_error("bind() failed: %m");
+                        log_error("bind(%s) failed: %m", sa.un.sun_path);
                         return -errno;
                 }
 
                 chmod(sa.un.sun_path, 0666);
 
                 if (listen(s->stdout_fd, SOMAXCONN) < 0) {
-                        log_error("listen() failed: %m");
+                        log_error("listen(%s) failed: %m", sa.un.sun_path);
                         return -errno;
                 }
         } else
--- src/journal/journald-syslog.c
+++ src/journal/journald-syslog.c	2014-07-21 00:00:00.000000000 +0000
@@ -437,7 +437,7 @@ int server_open_syslog_socket(Server *s)
 
                 r = bind(s->syslog_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));
                 if (r < 0) {
-                        log_error("bind() failed: %m");
+                        log_error("bind(%s) failed: %m", sa.un.sun_path);
                         return -errno;
                 }
 
--- src/login/logind-acl.c
+++ src/login/logind-acl.c	2014-07-21 10:59:04.986235573 +0000
@@ -277,7 +277,10 @@ int devnode_acl_all(struct udev *udev,
         SET_FOREACH(n, nodes, i) {
                 int k;
 
-                log_debug("Fixing up ACLs at %s for seat %s", n, seat);
+                log_debug("Changing ACLs at %s for seat %s (uid "UID_FMT"→"UID_FMT"%s%s)",
+                          n, seat, old_uid, new_uid,
+                          del ? " del" : "", add ? " add" : "");
+
                 k = devnode_acl(n, flush, del, old_uid, add, new_uid);
                 if (k < 0)
                         r = k;
--- src/shared/ask-password-api.c
+++ src/shared/ask-password-api.c	2014-07-21 00:00:00.000000000 +0000
@@ -275,7 +275,7 @@ static int create_socket(char **name) {
 
         if (r < 0) {
                 r = -errno;
-                log_error("bind() failed: %m");
+                log_error("bind(%s) failed: %m", sa.un.sun_path);
                 goto fail;
         }
 
