diff options
author | Maciej W. Rozycki <macro@redhat.com> | 2025-09-05 11:53:31 +0100 |
---|---|---|
committer | Maciej W. Rozycki <macro@redhat.com> | 2025-09-05 11:53:31 +0100 |
commit | 5d45da09e6bd0a66ec3b7aa9f279ee225dcbae52 (patch) | |
tree | b40cc9c3aa4189f63acb24a2d09b65ab32fe053b | |
parent | 2d47b01de020c2e07f25e4b8904419b707920ec4 (diff) | |
download | glibc-5d45da09e6bd0a66ec3b7aa9f279ee225dcbae52.zip glibc-5d45da09e6bd0a66ec3b7aa9f279ee225dcbae52.tar.gz glibc-5d45da09e6bd0a66ec3b7aa9f279ee225dcbae52.tar.bz2 |
testsuite: Update tests for 'xfclose' use
Convert (some) tests to use 'xfclose' rather than using plain 'fclose'
call with no error checking or plain missing such a call.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
-rw-r--r-- | elf/tst-audit25.h | 2 | ||||
-rw-r--r-- | elf/tst-pldd.c | 2 | ||||
-rw-r--r-- | libio/tst-getdelim.c | 2 | ||||
-rw-r--r-- | localedata/tst-bz13988.c | 2 | ||||
-rw-r--r-- | localedata/tst-scanf-width-digit.c | 2 | ||||
-rw-r--r-- | localedata/tst-scanf-width-point.c | 2 | ||||
-rw-r--r-- | misc/tst-mntent-escape.c | 2 | ||||
-rw-r--r-- | stdio-common/bug26.c | 1 | ||||
-rw-r--r-- | stdio-common/tst-fgets.c | 1 |
9 files changed, 12 insertions, 4 deletions
diff --git a/elf/tst-audit25.h b/elf/tst-audit25.h index b9cd11d..49d1459 100644 --- a/elf/tst-audit25.h +++ b/elf/tst-audit25.h @@ -44,5 +44,5 @@ compare_output (void *buffer, size_t length, const char *ref[], size_t reflen) TEST_COMPARE (found[i], true); free (line); - fclose (in); + xfclose (in); } diff --git a/elf/tst-pldd.c b/elf/tst-pldd.c index 3326ff9..e44713d 100644 --- a/elf/tst-pldd.c +++ b/elf/tst-pldd.c @@ -158,7 +158,7 @@ do_test (void) TEST_COMPARE (interpreter_found, true); TEST_COMPARE (libc_found, true); - fclose (out); + xfclose (out); } support_capture_subprocess_free (&pldd); diff --git a/libio/tst-getdelim.c b/libio/tst-getdelim.c index 829b12c..1f35f9f 100644 --- a/libio/tst-getdelim.c +++ b/libio/tst-getdelim.c @@ -47,7 +47,7 @@ do_test (void) TEST_COMPARE_BLOB (lineptr, 4, "abc\0", 4); TEST_VERIFY (getdelim (&lineptr, &linelen, '\0', memstream) != -1); TEST_COMPARE_BLOB (lineptr, 5, "d\nef\0", 5); - fclose (memstream); + xfclose (memstream); free (lineptr); return 0; diff --git a/localedata/tst-bz13988.c b/localedata/tst-bz13988.c index 43ab593..0af85f6 100644 --- a/localedata/tst-bz13988.c +++ b/localedata/tst-bz13988.c @@ -48,6 +48,8 @@ do_test (void) DIAG_POP_NEEDS_COMMENT; + xfclose (f); + return 0; } diff --git a/localedata/tst-scanf-width-digit.c b/localedata/tst-scanf-width-digit.c index f9883a1..993a57d 100644 --- a/localedata/tst-scanf-width-digit.c +++ b/localedata/tst-scanf-width-digit.c @@ -53,6 +53,8 @@ do_test (void) DIAG_POP_NEEDS_COMMENT; + xfclose (f); + return 0; } diff --git a/localedata/tst-scanf-width-point.c b/localedata/tst-scanf-width-point.c index 9469527..34f61c3 100644 --- a/localedata/tst-scanf-width-point.c +++ b/localedata/tst-scanf-width-point.c @@ -45,6 +45,8 @@ do_test (void) TEST_VERIFY_EXIT (fgetc (f) == 0xd9); TEST_VERIFY_EXIT (fgetc (f) == 0xab); + xfclose (f); + return 0; } diff --git a/misc/tst-mntent-escape.c b/misc/tst-mntent-escape.c index 13996ca..675bce7 100644 --- a/misc/tst-mntent-escape.c +++ b/misc/tst-mntent-escape.c @@ -87,7 +87,7 @@ do_test (void) TEST_COMPARE(tests[i].mnt_freq, ret->mnt_freq); TEST_COMPARE(tests[i].mnt_passno, ret->mnt_passno); - fclose (fp); + xfclose (fp); } return 0; diff --git a/stdio-common/bug26.c b/stdio-common/bug26.c index ea0367e..5c8f678 100644 --- a/stdio-common/bug26.c +++ b/stdio-common/bug26.c @@ -34,6 +34,7 @@ main (void) input. */ lost |= (fscanf (f, "%lf", &d) != 0); c = fgetc (f); + xfclose (f); lost |= c != 'e'; puts (lost ? "Test FAILED!" : "Test succeeded."); return lost; diff --git a/stdio-common/tst-fgets.c b/stdio-common/tst-fgets.c index 4545c29..82edb20 100644 --- a/stdio-common/tst-fgets.c +++ b/stdio-common/tst-fgets.c @@ -14,6 +14,7 @@ do_test (void) int res = bp != buf; bp = fgets_unlocked (buf, sizeof (buf), fp); printf ("fgets_unlocked: %s\n", bp == buf ? "OK" : "ERROR"); + xfclose (fp); res |= bp != buf; return res; } |