finger

finger fortune@hhvn.uk
Log | Files | Refs | LICENSE

commit 93c21520270e9b2b933c90c7f7bb7b12ac78280b
parent fe515ee05581b91f0728d16d31d191f77e6999a1
Author: hhvn <dev@hhvn.uk>
Date:   Sun, 11 Jul 2021 18:23:59 +0100

finger.c: print host/port with connect() and socket() failures

Diffstat:
Mfinger.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/finger.c b/finger.c @@ -57,9 +57,9 @@ finger(char *user, char *host, char *port, int w) { if ((sret = getaddrinfo(host, port, &hints, &ai)) != 0 || ai == NULL) die(1, "%s%s: %s:%s\n", verbose ? "getaddrinfo(): " : "", gai_strerror(sret), host, port); if ((sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol)) == 1) - die(1, "%s%s\n", verbose ? "socket(): " : "", strerror(errno)); + die(1, "%s%s: %s:%s\n", verbose ? "socket(): " : "", strerror(errno), host port); if (connect(sock, ai->ai_addr, ai->ai_addrlen) == -1) - die(1, "%s%s\n", verbose ? "connect(): " : "", strerror(errno)); + die(1, "%s%s: %s:%s\n", verbose ? "connect(): " : "", strerror(errno), host, port); freeaddrinfo(ai);