summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 502d803)
raw | patch | inline | side by side (parent: 502d803)
author | Jonathan Neuschäfer <j.neuschaefer@gmx.net> | |
Wed, 15 Jun 2011 20:00:24 +0000 (22:00 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 23 Jun 2011 08:50:50 +0000 (10:50 +0200) |
With libmpdclient older than version 2.4.0, connection_settings_name()
will return g_strdup(options.host), but options.host can be NULL.
Return g_strdup("localhost") in that case, assuming localhost is
mpd_connection_new's "default host".
will return g_strdup(options.host), but options.host can be NULL.
Return g_strdup("localhost") in that case, assuming localhost is
mpd_connection_new's "default host".
src/main.c | patch | blob | history |
diff --git a/src/main.c b/src/main.c
index 5b31f41a410dcec78d3cb907e41264cd18addeb3..185ca5d97405a25a2950ff6ba0520c13dc1d4d0d 100644 (file)
--- a/src/main.c
+++ b/src/main.c
return settings_name(settings);
#else
(void)connection;
- return g_strdup(options.host);
+
+ /*
+ * localhost is actually not correct, we only know that
+ * mpd_connection_new() has connected to the "default host".
+ */
+ const char *name = options.host ?: "localhost";
+ return g_strdup(name);
#endif
}