-
Notifications
You must be signed in to change notification settings - Fork 103
Closed
Description
I tried reading output from stderr from a process, and it gets all messed up. It seems the length of the buffer returned is correct, but only the first couple of hundred bytes are filled, the rest are zeroes.
Looking at the code, it seems that read_atmost_n does not handle partial reads correctly. Changing this line to the following seems to fix this.
int read_bytes = read(fd, buf + rbytes, read_upto - rbytes)
On a related note, I suspect that if read_all resizes the buffer and causes a realloc, then the buffer variable might become invalid.
Metadata
Metadata
Assignees
Labels
No labels