diff --git a/compiler-rt/test/asan/TestCases/Posix/coverage-fork.cpp b/compiler-rt/test/asan/TestCases/Posix/coverage-fork.cpp index fec9ba081b752..a8768479de2f6 100644 --- a/compiler-rt/test/asan/TestCases/Posix/coverage-fork.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/coverage-fork.cpp @@ -26,11 +26,14 @@ void baz() { printf("baz\n"); } int main(int argc, char **argv) { pid_t child_pid = fork(); + char buf[100]; if (child_pid == 0) { - fprintf(stderr, "Child PID: %d\n", getpid()); + snprintf(buf, sizeof(buf), "Child PID: %ld\n", (long)getpid()); + write(2, buf, strlen(buf)); baz(); } else { - fprintf(stderr, "Parent PID: %d\n", getpid()); + snprintf(buf, sizeof(buf), "Parent PID: %ld\n", (long)getpid()); + write(2, buf, strlen(buf)); foo(); bar();