dawn/node: Handle printf() erroring
printf() can return -1 on error. In this situation, don't adjust msg with a negative offset. Fixes a spurious crash when emitting lots of text. Change-Id: Id1e9402bbbe3dd49cf08e660dea0cf67c5369516 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116289 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
e0254998cf
commit
e45bf9f3d6
|
@ -82,7 +82,7 @@ const char* str(WGPUErrorType ty) {
|
||||||
void chunkedWrite(const char* msg) {
|
void chunkedWrite(const char* msg) {
|
||||||
while (true) {
|
while (true) {
|
||||||
auto n = printf("%.4096s", msg);
|
auto n = printf("%.4096s", msg);
|
||||||
if (n == 0) {
|
if (n <= 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
msg += n;
|
msg += n;
|
||||||
|
|
Loading…
Reference in New Issue