mirror of
https://github.com/NikitaIvanovV/ctpv.git
synced 2024-11-28 07:23:07 +01:00
Fix: write/read expect number of bytes, not len
This commit is contained in:
parent
302c77245b
commit
09e688d53b
@ -132,7 +132,7 @@ static int run(Preview *p, int *exitcode)
|
||||
if (*exitcode != FAILED_PREVIEW_EC) {
|
||||
char buf[256];
|
||||
int len;
|
||||
while ((len = read(pipe_fds[0], buf, LEN(buf))) > 0) {
|
||||
while ((len = read(pipe_fds[0], buf, sizeof(buf))) > 0) {
|
||||
write(STDOUT_FILENO, buf, len);
|
||||
}
|
||||
|
||||
|
2
server.c
2
server.c
@ -90,7 +90,7 @@ static int listen(char *fifo)
|
||||
|
||||
if (pollfd.revents & POLLIN) {
|
||||
static char buf[1024];
|
||||
while ((len = read(pollfd.fd, buf, LEN(buf))) > 0) {
|
||||
while ((len = read(pollfd.fd, buf, sizeof(buf))) > 0) {
|
||||
/* But first byte equal to 0 means "exit" */
|
||||
if (buf[0] == 0)
|
||||
goto close;
|
||||
|
Loading…
Reference in New Issue
Block a user