diff --git a/tools/client.c b/tools/client.c
index 73fef47..e9eab4c 100644
--- a/tools/client.c
+++ b/tools/client.c
@@ -41,6 +41,7 @@ char buf[256];
 int fd;
 int verbose = 1;
 bool dryrun = false;
+int end_status = 0;
 
 pthread_mutex_t mymutex;
 
@@ -82,6 +83,13 @@ static int printstatus(ipc_message *msg)
  */
 static int end(RECOVERY_STATUS status)
 {
+	if (status != FAILURE) {
+		end_status = 0;
+	}
+	else {
+		end_status = 1;
+	}
+
 	printf("Swupdate %s\n",
 		status == FAILURE ? "*failed* !" :
 			"was successful !");
@@ -103,6 +111,11 @@ static int send_file(const char* filename) {
 
 	/* synchronize with a mutex */
 	pthread_mutex_lock(&mymutex);
+
+
+	/* May be set non-zero by end() function on failure */
+	end_status = 0;
+
 	rc = swupdate_async_start(readimage, printstatus,
 				end, dryrun);
 	if (rc)
@@ -114,7 +127,7 @@ static int send_file(const char* filename) {
 	/* End called, unlock and exit */
 	pthread_mutex_unlock(&mymutex);
 
-	return 0;
+	return end_status;
 }
 
 
