summaryrefslogtreecommitdiffstats
path: root/tools/idevicedebug.c
diff options
context:
space:
mode:
authorGravatar Ben Wagner2020-02-06 18:25:32 -0500
committerGravatar Nikias Bassen2022-03-29 11:59:43 +0200
commitb08be09c0da5ab6a68cc6079bd35d895ba2f8b99 (patch)
treef1b264e6661c7a943cfc5e1b16cfe014abf4b1ea /tools/idevicedebug.c
parentcea58e5736e870d7a696e86d48f898e8c47d198f (diff)
downloadlibimobiledevice-b08be09c0da5ab6a68cc6079bd35d895ba2f8b99.tar.gz
libimobiledevice-b08be09c0da5ab6a68cc6079bd35d895ba2f8b99.tar.bz2
fix zero status
Diffstat (limited to 'tools/idevicedebug.c')
-rw-r--r--tools/idevicedebug.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c
index 36a4fa7..24cc46d 100644
--- a/tools/idevicedebug.c
+++ b/tools/idevicedebug.c
@@ -149,24 +149,26 @@ static debugserver_error_t debugserver_client_handle_response(debugserver_client
dres = DEBUGSERVER_E_UNKNOWN_ERROR;
} else if (r[0] == 'E' || r[0] == 'W') {
- debugserver_decode_string(r + 1, strlen(r) - 1, &o);
- /* dogben: 'W' + byte seems to mean "process exited with this status." */
- if (r[0] == 'W' && strlen(o) == 1) {
- printf("Exit status: %u\n", o[0]);
- if (exit_status != NULL) {
+ /* dogben: 'W' + hex-encoded byte seems to mean "process exited with this status." */
+ if (r[0] == 'W' && strlen(r) == 3 && exit_status != NULL) {
+ debugserver_decode_string(r + 1, strlen(r) - 1, &o);
+ if (o != NULL) {
+ printf("Exit status: %u\n", o[0]);
*exit_status = o[0];
+ free(o);
+ o = NULL;
+ free(*response);
+ *response = NULL;
+ return dres;
}
- } else {
- printf("%s: %s\n", (r[0] == 'E' ? "ERROR": "WARNING") , o);
- }
- if (o != NULL) {
- free(o);
- o = NULL;
}
+
+ printf("%s: %s\n", (r[0] == 'E' ? "ERROR": "WARNING") , r + 1);
+
free(*response);
*response = NULL;
- if (!send_reply || (exit_status != NULL && *exit_status >= 0))
+ if (!send_reply)
return dres;
/* send reply */