summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Kralevich2013-10-24 10:53:48 -0500
committerNick Kralevich2013-10-24 13:01:16 -0500
commit917045222a69021eb36aea96708649c709685509 (patch)
tree53ba3f23a6a4449175f84730cfafe4dffae7b8c2
parenta9e453f1b552699f69dca19599c7624a581089bd (diff)
downloadplatform-system-core-917045222a69021eb36aea96708649c709685509.tar.gz
platform-system-core-917045222a69021eb36aea96708649c709685509.tar.xz
platform-system-core-917045222a69021eb36aea96708649c709685509.zip
Don't return immediately from reboot commands.
The reboot commands return too fast, interfering with testing. Add a pause(), which will allow the device time to complete the reboot. Change-Id: Ie9cc6eea67b7ff662ec71ea2329cbb94f8d55404 Bug: 11369303
-rw-r--r--adb/services.c4
-rw-r--r--reboot/reboot.c5
2 files changed, 9 insertions, 0 deletions
diff --git a/adb/services.c b/adb/services.c
index f0d587817..951048e58 100644
--- a/adb/services.c
+++ b/adb/services.c
@@ -144,7 +144,11 @@ void reboot_service(int fd, void *arg)
144 if (ret < 0) { 144 if (ret < 0) {
145 snprintf(buf, sizeof(buf), "reboot failed: %d\n", ret); 145 snprintf(buf, sizeof(buf), "reboot failed: %d\n", ret);
146 writex(fd, buf, strlen(buf)); 146 writex(fd, buf, strlen(buf));
147 goto cleanup;
147 } 148 }
149 // Don't return early. Give the reboot command time to take effect
150 // to avoid messing up scripts which do "adb reboot && adb wait-for-device"
151 while(1) { pause(); }
148cleanup: 152cleanup:
149 free(arg); 153 free(arg);
150 adb_close(fd); 154 adb_close(fd);
diff --git a/reboot/reboot.c b/reboot/reboot.c
index 0e5170d42..d9a422764 100644
--- a/reboot/reboot.c
+++ b/reboot/reboot.c
@@ -68,6 +68,11 @@ int main(int argc, char *argv[])
68 perror("reboot"); 68 perror("reboot");
69 exit(EXIT_FAILURE); 69 exit(EXIT_FAILURE);
70 } 70 }
71
72 // Don't return early. Give the reboot command time to take effect
73 // to avoid messing up scripts which do "adb shell reboot && adb wait-for-device"
74 while(1) { pause(); }
75
71 fprintf(stderr, "Done\n"); 76 fprintf(stderr, "Done\n");
72 return 0; 77 return 0;
73} 78}