From 5a536efa5b5f5d973232846d5fe6818df84ab5dc Mon Sep 17 00:00:00 2001 From: Yuriy Zabroda Date: Tue, 17 Jul 2012 14:52:47 +0300 Subject: [PATCH] Avoid zombies on androidscreencast When using a third party screen capture program called androidscreencast (http://code.google.com/p/androidscreencast/) to get the framebuffer of the device, there are tons of screencap zombie processes got left behind. The issue is also mentioned here: http://code.google.com/p/android/issues/detail?id=22836. The cause of the issue is that adbd spawns off screencap processes, and these child processes were not waited to be finished. This change fixes the issue. Change-Id: Ife928d65ecf6a2ff39b8b72ddba930fda6733a00 Signed-off-by: Yuriy Zabroda --- adb/framebuffer_service.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/adb/framebuffer_service.c b/adb/framebuffer_service.c index 862dd91c8..20c08d23f 100644 --- a/adb/framebuffer_service.c +++ b/adb/framebuffer_service.c @@ -19,6 +19,9 @@ #include #include #include +#include +#include +#include #include "fdevent.h" #include "adb.h" @@ -169,6 +172,8 @@ void framebuffer_service(int fd, void *cookie) if(writex(fd, buf, fbinfo.size % sizeof(buf))) goto done; done: + TEMP_FAILURE_RETRY(waitpid(pid, NULL, 0)); + close(fds[0]); close(fds[1]); close(fd);