From 555ebfd2c69eae7df7dcd274576ae424c54cd6a4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 6 Jan 2015 09:42:28 +0100 Subject: status socket: better error messages on bind errors --- src/status.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/status.c b/src/status.c index b9f5f34..42f8335 100644 --- a/src/status.c +++ b/src/status.c @@ -228,8 +228,15 @@ void fastd_status_init(void) { sa->sun_family = AF_UNIX; strcpy(sa->sun_path, conf.status_socket); - if (bind(ctx.status_fd, (struct sockaddr*)sa, len)) - exit_errno("fastd_status_init: bind"); + if (bind(ctx.status_fd, (struct sockaddr*)sa, len)) { + switch (errno) { + case EADDRINUSE: + exit_error("unable to create status socket: the path `%s' already exists", conf.status_socket); + + default: + exit_errno("unable to create status socket"); + } + } if (listen(ctx.status_fd, 4)) exit_errno("fastd_status_init: listen"); -- cgit v1.2.3