Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a536efa authored by Yuriy Zabroda's avatar Yuriy Zabroda
Browse files

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: default avatarYuriy Zabroda <yuriy.zabroda@ti.com>
parent f694ba5f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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 @@ 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);