diff options
author | Willy Tarreau <w@1wt.eu> | 2009-10-14 15:16:48 +0200 |
---|---|---|
committer | Willy Tarreau <w@1wt.eu> | 2009-10-14 20:40:41 +0200 |
commit | 336708878c26c4e18683f76bfa8875a502e23101 (patch) | |
tree | f2157ce797399c81f54997215c2db6b5e77311a2 /src | |
parent | 8087c66b3c099c930db96d0af7c47641f18eb51d (diff) | |
download | haproxy-336708878c26c4e18683f76bfa8875a502e23101.tar.gz |
[MINOR] unix socket: report the socket path in case of bind error
When an error occurs during binding of the stats unix socket, messages
are far from clear for the user !
(cherry picked from commit 5d53634f3634ed377843d37ca5450ffed43ecda8)
Diffstat (limited to 'src')
-rw-r--r-- | src/proto_uxst.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/proto_uxst.c b/src/proto_uxst.c index b4685d596..c3fb0ec31 100644 --- a/src/proto_uxst.c +++ b/src/proto_uxst.c @@ -113,36 +113,36 @@ static int create_uxst_socket(const char *path, uid_t uid, gid_t gid, mode_t mod /* 1. create socket names */ if (!path[0]) { - Alert("Invalid name for a UNIX socket. Aborting.\n"); + Alert("Invalid empty name for a UNIX socket. Aborting.\n"); goto err_return; } ret = snprintf(tempname, MAXPATHLEN, "%s.%d.tmp", path, pid); if (ret < 0 || ret >= MAXPATHLEN) { - Alert("name too long for UNIX socket. Aborting.\n"); + Alert("name too long for UNIX socket (%s). Aborting.\n", path); goto err_return; } ret = snprintf(backname, MAXPATHLEN, "%s.%d.bak", path, pid); if (ret < 0 || ret >= MAXPATHLEN) { - Alert("name too long for UNIX socket. Aborting.\n"); + Alert("name too long for UNIX socket (%s). Aborting.\n", path); goto err_return; } /* 2. clean existing orphaned entries */ if (unlink(tempname) < 0 && errno != ENOENT) { - Alert("error when trying to unlink previous UNIX socket. Aborting.\n"); + Alert("error when trying to unlink previous UNIX socket (%s). Aborting.\n", path); goto err_return; } if (unlink(backname) < 0 && errno != ENOENT) { - Alert("error when trying to unlink previous UNIX socket. Aborting.\n"); + Alert("error when trying to unlink previous UNIX socket (%s). Aborting.\n", path); goto err_return; } /* 3. backup existing socket */ if (link(path, backname) < 0 && errno != ENOENT) { - Alert("error when trying to preserve previous UNIX socket. Aborting.\n"); + Alert("error when trying to preserve previous UNIX socket (%s). Aborting.\n", path); goto err_return; } @@ -153,12 +153,12 @@ static int create_uxst_socket(const char *path, uid_t uid, gid_t gid, mode_t mod sock = socket(PF_UNIX, SOCK_STREAM, 0); if (sock < 0) { - Alert("cannot create socket for UNIX listener. Aborting.\n"); + Alert("cannot create socket for UNIX listener (%s). Aborting.\n", path); goto err_unlink_back; } if (sock >= global.maxsock) { - Alert("socket(): not enough free sockets for UNIX listener. Raise -n argument. Aborting.\n"); + Alert("socket(): not enough free sockets for UNIX listener (%s). Raise -n argument. Aborting.\n", path); goto err_unlink_temp; } @@ -169,18 +169,18 @@ static int create_uxst_socket(const char *path, uid_t uid, gid_t gid, mode_t mod if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) { /* note that bind() creates the socket <tempname> on the file system */ - Alert("cannot bind socket for UNIX listener. Aborting.\n"); + Alert("cannot bind socket for UNIX listener (%s). Aborting.\n", path); goto err_unlink_temp; } if (((uid != -1 || gid != -1) && (chown(tempname, uid, gid) == -1)) || (mode != 0 && chmod(tempname, mode) == -1)) { - Alert("cannot change UNIX socket ownership. Aborting.\n"); + Alert("cannot change UNIX socket ownership (%s). Aborting.\n", path); goto err_unlink_temp; } if (listen(sock, 0) < 0) { - Alert("cannot listen to socket for UNIX listener. Aborting.\n"); + Alert("cannot listen to socket for UNIX listener (%s). Aborting.\n", path); goto err_unlink_temp; } @@ -190,7 +190,7 @@ static int create_uxst_socket(const char *path, uid_t uid, gid_t gid, mode_t mod * backname. */ if (rename(tempname, path) < 0) { - Alert("cannot switch final and temporary sockets for UNIX listener. Aborting.\n"); + Alert("cannot switch final and temporary sockets for UNIX listener (%s). Aborting.\n", path); goto err_rename; } |