Loading adb/framebuffer_service.c +9 −7 Original line number Diff line number Diff line Loading @@ -55,13 +55,13 @@ struct fbinfo { void framebuffer_service(int fd, void *cookie) { struct fbinfo fbinfo; unsigned int i; unsigned int i, bsize; char buf[640]; int fd_screencap; int w, h, f; int fds[2]; if (pipe(fds) < 0) goto done; if (pipe(fds) < 0) goto pipefail; pid_t pid = fork(); if (pid < 0) goto done; Loading Loading @@ -164,17 +164,19 @@ void framebuffer_service(int fd, void *cookie) if(writex(fd, &fbinfo, sizeof(fbinfo))) goto done; /* write data */ for(i = 0; i < fbinfo.size; i += sizeof(buf)) { if(readx(fd_screencap, buf, sizeof(buf))) goto done; if(writex(fd, buf, sizeof(buf))) goto done; for(i = 0; i < fbinfo.size; i += bsize) { bsize = sizeof(buf); if (i + bsize > fbinfo.size) bsize = fbinfo.size - i; if(readx(fd_screencap, buf, bsize)) goto done; if(writex(fd, buf, bsize)) goto done; } if(readx(fd_screencap, buf, fbinfo.size % sizeof(buf))) goto done; if(writex(fd, buf, fbinfo.size % sizeof(buf))) goto done; done: TEMP_FAILURE_RETRY(waitpid(pid, NULL, 0)); close(fds[0]); close(fds[1]); pipefail: close(fd); } Loading
adb/framebuffer_service.c +9 −7 Original line number Diff line number Diff line Loading @@ -55,13 +55,13 @@ struct fbinfo { void framebuffer_service(int fd, void *cookie) { struct fbinfo fbinfo; unsigned int i; unsigned int i, bsize; char buf[640]; int fd_screencap; int w, h, f; int fds[2]; if (pipe(fds) < 0) goto done; if (pipe(fds) < 0) goto pipefail; pid_t pid = fork(); if (pid < 0) goto done; Loading Loading @@ -164,17 +164,19 @@ void framebuffer_service(int fd, void *cookie) if(writex(fd, &fbinfo, sizeof(fbinfo))) goto done; /* write data */ for(i = 0; i < fbinfo.size; i += sizeof(buf)) { if(readx(fd_screencap, buf, sizeof(buf))) goto done; if(writex(fd, buf, sizeof(buf))) goto done; for(i = 0; i < fbinfo.size; i += bsize) { bsize = sizeof(buf); if (i + bsize > fbinfo.size) bsize = fbinfo.size - i; if(readx(fd_screencap, buf, bsize)) goto done; if(writex(fd, buf, bsize)) goto done; } if(readx(fd_screencap, buf, fbinfo.size % sizeof(buf))) goto done; if(writex(fd, buf, fbinfo.size % sizeof(buf))) goto done; done: TEMP_FAILURE_RETRY(waitpid(pid, NULL, 0)); close(fds[0]); close(fds[1]); pipefail: close(fd); }