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 <yuriy.zabroda@ti.com>
diff --git a/adb/framebuffer_service.c b/adb/framebuffer_service.c
index 862dd91..20c08d2 100644
--- a/adb/framebuffer_service.c
+++ b/adb/framebuffer_service.c
@@ -19,6 +19,9 @@
 #include <unistd.h>
 #include <string.h>
 #include <fcntl.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/wait.h>
 
 #include "fdevent.h"
 #include "adb.h"
@@ -169,6 +172,8 @@
     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);