Index: test/sanitizer_common/TestCases/Posix/fgets.cc =================================================================== --- test/sanitizer_common/TestCases/Posix/fgets.cc +++ test/sanitizer_common/TestCases/Posix/fgets.cc @@ -1,20 +1,16 @@ // RUN: %clangxx -g %s -o %t && %run %t +#include #include int main(int argc, char **argv) { - FILE *fp; - char buf[2]; - char *s; - - fp = fopen(argv[0], "r"); - if (!fp) - return 1; + FILE *fp = fopen(argv[0], "r"); + assert(fp); - s = fgets(buf, sizeof(buf), fp); - if (!s) - return 2; + char buf[2]; + char *s = fgets(buf, sizeof(buf), fp); + assert(s); - fclose(fp); + assert(!fclose(fp)); return 0; } Index: test/sanitizer_common/TestCases/Posix/fputs_puts.cc =================================================================== --- test/sanitizer_common/TestCases/Posix/fputs_puts.cc +++ test/sanitizer_common/TestCases/Posix/fputs_puts.cc @@ -1,18 +1,12 @@ // RUN: %clangxx -g %s -o %t && %run %t | FileCheck %s // CHECK: {{^foobar$}} +#include #include int main(void) { - int r; - - r = fputs("foo", stdout); - if (r < 0) - return 1; - - r = puts("bar"); - if (r < 0) - return 1; + assert(fputs("foo", stdout) >= 0); + assert(puts("bar") >= 0); return 0; }