tClose connection on failure - spoon - dwm status utility (2f30 fork) | |
git clone git://src.adamsgaard.dk/spoon | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 2fc1f4927f97a4a86c887d67b6e9124d26afee7d | |
parent 97e55bd632212da6432ab1d6c00bb5f97604abe4 | |
Author: sin <[email protected]> | |
Date: Mon, 26 Sep 2016 16:43:53 +0100 | |
Close connection on failure | |
Diffstat: | |
M spoon.c | 4 +++- | |
1 file changed, 3 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/spoon.c b/spoon.c | |
t@@ -51,9 +51,11 @@ mpdread(char *buf, size_t len) | |
if (conn == NULL) { | |
conn = mpd_connection_new(NULL, 0, 0); | |
+ if (conn == NULL) | |
+ return -1; | |
if (mpd_connection_get_error(conn) != MPD_ERROR_SUCCESS) { | |
warnx("cannot connect to mpd"); | |
- return -1; | |
+ goto out; | |
} | |
} | |
mpd_send_current_song(conn); |