Merge "adb: avoid sign extension of shell return code." am: b5ac15a936

am: a6397564b6

Change-Id: I6d5e70872105ef569d7a2d2b1fbb488c66adfbbe
This commit is contained in:
Josh Gao 2019-03-15 21:18:43 -07:00 committed by android-build-merger
commit 3811ab5afa

View file

@ -295,7 +295,10 @@ int read_and_dump(int fd, bool use_shell_protocol = false,
callback->OnStderr(buffer_ptr, length); callback->OnStderr(buffer_ptr, length);
break; break;
case ShellProtocol::kIdExit: case ShellProtocol::kIdExit:
exit_code = protocol->data()[0]; // data() returns a char* which doesn't have defined signedness.
// Cast to uint8_t to prevent 255 from being sign extended to INT_MIN,
// which doesn't get truncated on Windows.
exit_code = static_cast<uint8_t>(protocol->data()[0]);
continue; continue;
default: default:
continue; continue;