am d4725517: am ec7d9dc7: Merge "Avoid zombies on androidscreencast"
* commit 'd47255175ede1af31aee9132914e5d14549ba577':
Avoid zombies on androidscreencast
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);