qrexec: handle buffered writes correctly
In case when we have a buffered write, always append to the buffer, even if the pipe happens to be writable now. If not, in case of certain tight race we might end up writing buffered data in wrong order.
This commit is contained in:
parent
4087b1d052
commit
af7fefa73f
@ -60,6 +60,12 @@ int write_stdin(int fd, int clid, char *data, int len,
|
||||
struct buffer *buffer)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (buffer_len(buffer)) {
|
||||
buffer_append(buffer, data, len);
|
||||
return WRITE_STDIN_BUFFERED;
|
||||
}
|
||||
|
||||
ret = write(fd, data, len);
|
||||
if (ret == len)
|
||||
return WRITE_STDIN_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user