Merge pull request #2427 from Rosuav/retry-pipe-write

libobs/util: Retry pipe writes to avoid spurious failures on short write.
master
Jim 2020-02-24 23:41:48 -08:00 committed by GitHub
commit 267874ad92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -93,5 +93,12 @@ size_t os_process_pipe_write(os_process_pipe_t *pp, const uint8_t *data,
return 0;
}
return fwrite(data, 1, len, pp->file);
size_t written = 0;
while (written < len) {
size_t ret = fwrite(data + written, 1, len - written, pp->file);
if (!ret)
return written;
written += ret;
}
return written;
}