From db30ea0c481a2ea34a2165c0768a8017b4a46ac2 Mon Sep 17 00:00:00 2001 From: Alex Young Date: Mon, 16 Jul 2012 11:04:45 +0100 Subject: [PATCH] Better error handling for remotes --- src/remote.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/remote.c b/src/remote.c index 778c6dc..ee714ff 100644 --- a/src/remote.c +++ b/src/remote.c @@ -15,12 +15,13 @@ void print_response( const char * response ) NULLCHECK( response ); exit_status = atoi(response); - response_text = strchr( response, ':' ) + 2; + response_text = strchr( response, ':' ); - NULLCHECK( response_text ); + FATAL_IF_NULL( response_text, + "Error parsing server response: '%s'", response ); out = exit_status > 0 ? stderr : stdout; - fprintf(out, "%s\n", response_text ); + fprintf(out, "%s\n", response_text + 2); } void do_remote_command(char* command, char* socket_name, int argc, char** argv)