summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-01-06 09:42:28 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-01-06 09:43:56 +0100
commit555ebfd2c69eae7df7dcd274576ae424c54cd6a4 (patch)
treea023eeeaecca59f1afbdfed2e11d10af8dd942b0
parentf64c8e3bee2e9c61cf18c93c6a328dd5d6d8e1b4 (diff)
downloadfastd-555ebfd2c69eae7df7dcd274576ae424c54cd6a4.tar
fastd-555ebfd2c69eae7df7dcd274576ae424c54cd6a4.zip
status socket: better error messages on bind errors
-rw-r--r--src/status.c11
1 files changed, 9 insertions, 2 deletions
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");