mirror of
https://github.com/Genymobile/scrcpy
synced 2025-01-03 05:02:07 +00:00
Add missing error handling
If "adb get-serialno" fails, attempting to read from the uninitialized pipe is incorrect.
This commit is contained in:
parent
de50846905
commit
632bd5697b
@ -239,6 +239,9 @@ adb_execute_for_output(const char *serial, const char *const adb_cmd[],
|
|||||||
const char *name) {
|
const char *name) {
|
||||||
sc_pipe pout;
|
sc_pipe pout;
|
||||||
sc_pid pid = adb_execute_p(serial, adb_cmd, adb_cmd_len, NULL, &pout, NULL);
|
sc_pid pid = adb_execute_p(serial, adb_cmd, adb_cmd_len, NULL, &pout, NULL);
|
||||||
|
if (pid == SC_PROCESS_NONE) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
ssize_t r = sc_pipe_read_all(pout, buf, buf_len);
|
ssize_t r = sc_pipe_read_all(pout, buf, buf_len);
|
||||||
sc_pipe_close(pout);
|
sc_pipe_close(pout);
|
||||||
|
Loading…
Reference in New Issue
Block a user