From 5767d0dd5ae44978b7a80ba08de32fe51822cbb4 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Fri, 4 Mar 2016 15:51:03 -0800 Subject: [PATCH] adb: wait for restore to complete before returning. If we return before waiting for the other side to finish, it'll get sent SIGHUP. Bug: http://b/27414382 Change-Id: I93514d2242ed0d7aa93a6ec6836270dc0783506d (cherry picked from commit d26abed750640b4225a11763510f61ade3dd225c) --- adb/commandline.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/adb/commandline.cpp b/adb/commandline.cpp index 18e7af4f5..e522119b1 100644 --- a/adb/commandline.cpp +++ b/adb/commandline.cpp @@ -1265,6 +1265,9 @@ static int restore(int argc, const char** argv) { printf("Now unlock your device and confirm the restore operation.\n"); copy_to_file(tarFd, fd); + // Wait until the other side finishes, or it'll get sent SIGHUP. + copy_to_file(fd, STDOUT_FILENO); + adb_close(fd); adb_close(tarFd); return 0;