Display and control your Android device
Make intr optional for adb commands
Romain Vimont3bb24b3926a2
diff --git a/app/src/adb/adb.c b/app/src/adb/adb.cindex 8ce9cc6f..8742c4d0 100644--- a/app/src/adb/adb.c+++ b/app/src/adb/adb.c@@ -150,7 +150,7 @@ process_check_success_internal(sc_pid pid, const char *name, bool close,static boolprocess_check_success_intr(struct sc_intr *intr, sc_pid pid, const char *name,unsigned flags) {- if (!sc_intr_set_process(intr, pid)) {+ if (intr && !sc_intr_set_process(intr, pid)) {// Already interruptedreturn false;}@@ -158,7 +158,9 @@ process_check_success_intr(struct sc_intr *intr, sc_pid pid, const char *name,// Always pass close=false, interrupting would be racy otherwisebool ret = process_check_success_internal(pid, name, false, flags);- sc_intr_set_process(intr, SC_PROCESS_NONE);+ if (intr) {+ sc_intr_set_process(intr, SC_PROCESS_NONE);+ }// Close separatelysc_process_close(pid);diff --git a/app/src/util/process_intr.c b/app/src/util/process_intr.cindex 940fe89f..d37bd5a5 100644--- a/app/src/util/process_intr.c+++ b/app/src/util/process_intr.c@@ -3,27 +3,33 @@ssize_tsc_pipe_read_intr(struct sc_intr *intr, sc_pid pid, sc_pipe pipe, char *data,size_t len) {- if (!sc_intr_set_process(intr, pid)) {+ if (intr && !sc_intr_set_process(intr, pid)) {// Already interruptedreturn false;}ssize_t ret = sc_pipe_read(pipe, data, len);- sc_intr_set_process(intr, SC_PROCESS_NONE);+ if (intr) {+ sc_intr_set_process(intr, SC_PROCESS_NONE);+ }+return ret;}ssize_tsc_pipe_read_all_intr(struct sc_intr *intr, sc_pid pid, sc_pipe pipe,char *data, size_t len) {- if (!sc_intr_set_process(intr, pid)) {+ if (intr && !sc_intr_set_process(intr, pid)) {// Already interruptedreturn false;}ssize_t ret = sc_pipe_read_all(pipe, data, len);- sc_intr_set_process(intr, SC_PROCESS_NONE);+ if (intr) {+ sc_intr_set_process(intr, SC_PROCESS_NONE);+ }+return ret;}