[tint] Fix UBU in command_posix.cc
Apparently this is UBU on Mac,
https://logs.chromium.org/logs/dawn/buildbucket/cr-buildbucket/8718038088705886065/+/u/CMake_build_default_targets/Compile_default_targets/stdout
Bug: 394825124
Change-Id: I8c498934cf23a7ccdeb5a9d0a55a6588e780395f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/235915
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/utils/command/command_posix.cc b/src/tint/utils/command/command_posix.cc
index 4513a1e..8ac9af8 100644
--- a/src/tint/utils/command/command_posix.cc
+++ b/src/tint/utils/command/command_posix.cc
@@ -92,8 +92,8 @@
public:
/// Constructs the pipe
Pipe() {
- int pipes[2] = {};
- if (pipe(pipes) == 0) {
+ std::array<int, 2> pipes = {};
+ if (pipe(pipes.data()) == 0) {
read = File(pipes[0]);
write = File(pipes[1]);
}
@@ -228,7 +228,7 @@
stdin_pipe.write.Close();
// Accumulate the stdout and stderr output from the child process
- pollfd poll_fds[2];
+ std::array<pollfd, 2> poll_fds;
poll_fds[0].fd = stdout_pipe.read;
poll_fds[0].events = POLLIN;
poll_fds[1].fd = stderr_pipe.read;
@@ -238,7 +238,7 @@
bool stdout_open = true;
bool stderr_open = true;
while (stdout_open || stderr_open) {
- if (poll(poll_fds, 2, -1) < 0) {
+ if (poll(poll_fds.data(), 2, -1) < 0) {
break;
}
std::array<char, 256> buf;