From 1b466d2bab9a8178c6bb64020ee125d6337e033b Mon Sep 17 00:00:00 2001 From: Yo Chiang Date: Fri, 28 Aug 2020 22:00:42 +0800 Subject: gsi_tool should send STDIN_FILENO to gsid `gsi_tool` is `dup()`-ing FD 1, which is the STDOUT_FILENO, and sending it to `gsid`, and `gsid` is calling `read()` on the FD. `gsi_tool` should actually be sending FD 0, the STDIN, to `gsid`. Bug: 166589508 Test: gzip -c system.raw | adb shell "zcat | gsi_tool install ..." Change-Id: I9d7bb5f2a1146d3c5ac7332eae34a67963a6eb5d --- gsi_tool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsi_tool.cpp b/gsi_tool.cpp index f24fa5d..8839246 100644 --- a/gsi_tool.cpp +++ b/gsi_tool.cpp @@ -255,7 +255,7 @@ static int Install(sp gsid, int argc, char** argv) { return EX_SOFTWARE; } - android::base::unique_fd input(dup(1)); + android::base::unique_fd input(dup(STDIN_FILENO)); if (input < 0) { std::cerr << "Error duplicating descriptor: " << strerror(errno) << std::endl; return EX_SOFTWARE; -- cgit v1.2.3