diff --git a/cord/tests/cordtest.c b/cord/tests/cordtest.c index e9d204d1c..86a0fe548 100644 --- a/cord/tests/cordtest.c +++ b/cord/tests/cordtest.c @@ -287,9 +287,6 @@ static void test_extras(void) /* But we cannot call fclose as it might lead to double close. */ fprintf(stderr, "WARNING: remove failed: " FNAME1 "\n"); } - if (remove(FNAME2) != 0) { - fprintf(stderr, "WARNING: remove failed: " FNAME2 "\n"); - } } static int wrap_vprintf(CORD format, ...) @@ -402,6 +399,11 @@ int main(void) test_basics(); test_extras(); test_printf(); + + GC_gcollect(); /* to close f2 before the file removal */ + if (remove(FNAME2) != 0) { + fprintf(stderr, "WARNING: remove failed: " FNAME2 "\n"); + } CORD_fprintf(stdout, "SUCCEEDED\n"); return 0; }