From 7a72eff4a4717e975ab7ef39baff5667b12e8a13 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 21 Apr 2015 22:21:41 +0000 Subject: [PATCH] Simplify error messages when socket connect fails, suggested by "Karthik K". --- client.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/client.c b/client.c index 6d4b8a5a..d3ff05a6 100644 --- a/client.c +++ b/client.c @@ -265,8 +265,13 @@ client_main(int argc, char **argv, int flags) /* Initialize the client socket and start the server. */ fd = client_connect(socket_path, cmdflags & CMD_STARTSERVER); if (fd == -1) { - fprintf(stderr, "failed to connect to server: %s\n", - strerror(errno)); + if (errno == ECONNREFUSED) { + fprintf(stderr, "no server running on %s\n", + socket_path); + } else { + fprintf(stderr, "error connecting to %s (%s)\n", + socket_path, strerror(errno)); + } return (1); }