sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 4ecef547d4d3d5d514b43a29b9c538cb6d4c34a6
parent f15bdda87051daecd47ac4099aa2a4da31301794
Author: Thuban <thuban@singularity.fr>
Date:   Thu, 20 Jun 2013 20:43:10 +0200

 correctiong segfault when mpd not running. Don't understant why yet

Diffstat:
Mdwm.suckless.org/dwmstatus/mpdstatus.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dwm.suckless.org/dwmstatus/mpdstatus.c b/dwm.suckless.org/dwmstatus/mpdstatus.c @@ -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); @@ -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);