]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
testsuite: Update tests for 'xfclose' use
authorMaciej W. Rozycki <macro@redhat.com>
Fri, 5 Sep 2025 10:53:31 +0000 (11:53 +0100)
committerMaciej W. Rozycki <macro@redhat.com>
Fri, 5 Sep 2025 10:53:31 +0000 (11:53 +0100)
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>
elf/tst-audit25.h
elf/tst-pldd.c
libio/tst-getdelim.c
localedata/tst-bz13988.c
localedata/tst-scanf-width-digit.c
localedata/tst-scanf-width-point.c
misc/tst-mntent-escape.c
stdio-common/bug26.c
stdio-common/tst-fgets.c

index b9cd11de6b772f83da10ca7c92bc0eac6dd9dbb4..49d1459dceedc4db9056043187e19cd3681725c1 100644 (file)
@@ -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);
 }
index 3326ff918ffa562ee99ac9c8a30c7eb94a78c3e6..e44713dc433dca8aed24f21d4afb60e461f52347 100644 (file)
@@ -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);
index 829b12caf39a790dabd3185e511947e8a22bf5c8..1f35f9f685d40c20c0d39a606107687d218034c3 100644 (file)
@@ -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;
index 43ab593b317ad3052479fba512c2d347d545ba83..0af85f6693c2880633ef745085cfea5cb9449214 100644 (file)
@@ -48,6 +48,8 @@ do_test (void)
 
   DIAG_POP_NEEDS_COMMENT;
 
+  xfclose (f);
+
   return 0;
 }
 
index f9883a1c82940eb879f124f0f854834bc46737db..993a57d4ffc09756901faeccf37ecc827f27c5b8 100644 (file)
@@ -53,6 +53,8 @@ do_test (void)
 
   DIAG_POP_NEEDS_COMMENT;
 
+  xfclose (f);
+
   return 0;
 }
 
index 9469527d2cc524cfa7fcad55ad940d3dc18df62c..34f61c35668bd90afbe825a03aab1e7359e995e2 100644 (file)
@@ -45,6 +45,8 @@ do_test (void)
   TEST_VERIFY_EXIT (fgetc (f) == 0xd9);
   TEST_VERIFY_EXIT (fgetc (f) == 0xab);
 
+  xfclose (f);
+
   return 0;
 }
 
index 13996cac9f5adec5833b03c45f0c12952d084268..675bce799536d5ece87481c9dd796cb5aaef05c9 100644 (file)
@@ -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;
index ea0367e95f74909ebdfcda390a2f6aab52ea751a..5c8f678b4d40246afdb23f176444a66251d3b411 100644 (file)
@@ -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;
index 4545c2998b5d9ded668cbb15ad6b70f00b1eece2..82edb200bb82727eb44db0c090cbdbb6b18048d1 100644 (file)
@@ -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;
 }