diff options
-rw-r--r-- | src/status.c | 11 |
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"); |