Add fix for O_NONBLOCK file-descriptor as output pipe

If the output of an fd is a pipe with O_NONBLOCK set, the script will die as
soon as the pipe fills up due to the write call returning with EAGAIN. This
fixes that.

Signed-off-by: Tyrolyean <tyrolyean@tyrolyean.net>
This commit is contained in:
Tyrolyean 2022-07-17 20:03:32 +02:00
parent 4123b78a81
commit be8f7d1716
No known key found for this signature in database
GPG Key ID: 81EC9BAC5E9667C6
1 changed files with 1 additions and 1 deletions

View File

@ -51,7 +51,7 @@ static int write_retry(int fd, const void *buffer, size_t size)
int ret = write(fd, buffer, size);
if (ret < 0) {
if (errno == EINTR)
if (errno == EINTR || errno == EAGAIN)
continue;
perror("write");
return -1;