More fixes
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c
index c596213..ae6dd02 100644
--- a/tools/idevicedebug.c
+++ b/tools/idevicedebug.c
@@ -61,7 +61,7 @@
quit_flag++;
}
-static void cancel_receive()
+static int cancel_receive()
{
return quit_flag;
}
@@ -130,9 +130,11 @@
} else if (r[0] == 'T') {
/* thread stopped information */
log_debug("Thread stopped. Details:\n%s", r + 1);
- /* "Thread stopped" seems to happen when assert() fails. Use bash convention where signals cause an exit status of 128 + signal */
- *exit_status = 128 + SIGABRT;
- /* Break out of the loop. */
+ if (exit_status != NULL) {
+ /* "Thread stopped" seems to happen when assert() fails. Use bash convention where signals cause an exit status of 128 + signal */
+ *exit_status = 128 + SIGABRT;
+ }
+ /* Break out of the loop. */
dres = DEBUGSERVER_E_UNKNOWN_ERROR;
} else if (r[0] == 'E') {
printf("ERROR: %s\n", r + 1);
@@ -141,8 +143,10 @@
debugserver_decode_string(r + 1, strlen(r) - 1, &o);
if (o != NULL) {
printf("Exit %s: %u\n", (r[0] == 'W' ? "status" : "due to signal"), o[0]);
+ if (exit_status != NULL) {
/* Use bash convention where signals cause an exit status of 128 + signal */
*exit_status = o[0] + (r[0] == 'W' ? 0 : 128);
+ }
} else {
debug_info("Unable to decode exit status from %s", r);
dres = DEBUGSERVER_E_UNKNOWN_ERROR;