[wiki] [sites] correctiong segfault when mpd not running. Don't understant why yet || Thuban
commit 4ecef547d4d3d5d514b43a29b9c538cb6d4c34a6
Author: Thuban <thuban_AT_singularity.fr>
Date: Thu Jun 20 20:43:10 2013 +0200
correctiong segfault when mpd not running. Don't understant why yet
diff --git a/dwm.suckless.org/dwmstatus/mpdstatus.c b/dwm.suckless.org/dwmstatus/mpdstatus.c
index 8132680..029b346 100644
--- a/dwm.suckless.org/dwmstatus/mpdstatus.c
+++ b/dwm.suckless.org/dwmstatus/mpdstatus.c
_AT_@ -23,7 +23,11 @@ getmpdstat() {
char * retstr = NULL;
int elapsed = 0, total = 0;
struct mpd_connection * conn = mpd_connection_new(NULL, 0, 30000);
- if (mpd_connection_get_error(conn)) return("");
+ if (!(conn = mpd_connection_new("localhost", 0, 30000)) ||
+ mpd_connection_get_error(conn)){
+ retstr = smprintf("");
+ return retstr;
+ }
mpd_command_list_begin(conn, true);
mpd_send_status(conn);
_AT_@ -31,7 +35,7 @@ getmpdstat() {
mpd_command_list_end(conn);
struct mpd_status* theStatus = mpd_recv_status(conn);
- if (!theStatus) return("");
+ if (!theStatus) retstr = smprintf("");
else
if (mpd_status_get_state(theStatus) == MPD_STATE_PLAY) {
mpd_response_next(conn);
Received on Thu Jun 20 2013 - 20:43:15 CEST
This archive was generated by hypermail 2.3.0
: Thu Jun 20 2013 - 20:48:20 CEST