From 9a93a60fbf383dd7453f02418c2d66aaae475af7 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 7 Jun 2023 16:45:56 +0200 Subject: [PATCH] raop: log last error on connection failure --- src/modules/module-raop/rtsp-client.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/module-raop/rtsp-client.c b/src/modules/module-raop/rtsp-client.c index 003291cb7..82fddf0c4 100644 --- a/src/modules/module-raop/rtsp-client.c +++ b/src/modules/module-raop/rtsp-client.c @@ -490,6 +490,7 @@ int pw_rtsp_client_connect(struct pw_rtsp_client *client, pw_log_error("getaddrinfo: %s", gai_strerror(res)); return -EINVAL; } + res = -ENOENT; for (rp = result; rp != NULL; rp = rp->ai_next) { fd = socket(rp->ai_family, rp->ai_socktype | SOCK_CLOEXEC | SOCK_NONBLOCK, @@ -501,12 +502,14 @@ int pw_rtsp_client_connect(struct pw_rtsp_client *client, if (res == 0 || (res < 0 && errno == EINPROGRESS)) break; + res = -errno; close(fd); } freeaddrinfo(result); if (rp == NULL) { - pw_log_error("Could not connect to %s:%u", hostname, port); + pw_log_error("Could not connect to %s:%u: %s", hostname, port, + spa_strerror(res)); return -EINVAL; }