summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@redhat.com>2025-09-05 11:53:31 +0100
committerMaciej W. Rozycki <macro@redhat.com>2025-09-05 11:53:31 +0100
commit2d47b01de020c2e07f25e4b8904419b707920ec4 (patch)
tree06aecaaeac19dc6eb4e01066bd0af68c2bfc231a /misc
parentfe709cc24578ecfd2ff5b07e10e3829fcb55075b (diff)
testsuite: Update tests for 'xfmemopen' use
Convert tests to use 'xfmemopen' rather than open-coding error checks with 'fmemopen' or plain missing them, where 'fmemopen' itself is not the scope of testing. Leave 'fmemopen' tests alone. Reviewed-by: Florian Weimer <fweimer@redhat.com>
Diffstat (limited to 'misc')
-rw-r--r--misc/tst-mntent-escape.c9
-rw-r--r--misc/tst-syslog.c4
2 files changed, 3 insertions, 10 deletions
diff --git a/misc/tst-mntent-escape.c b/misc/tst-mntent-escape.c
index 75363d39d5..13996cac9f 100644
--- a/misc/tst-mntent-escape.c
+++ b/misc/tst-mntent-escape.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <string.h>
#include <support/check.h>
+#include <support/xstdio.h>
struct const_mntent
{
@@ -54,13 +55,7 @@ do_test (void)
{
char buf[128];
struct mntent *ret, curtest;
- FILE *fp = fmemopen (buf, sizeof (buf), "w+");
-
- if (fp == NULL)
- {
- printf ("Failed to open file\n");
- return 1;
- }
+ FILE *fp = xfmemopen (buf, sizeof (buf), "w+");
curtest.mnt_fsname = strdupa (tests[i].mnt_fsname);
curtest.mnt_dir = strdupa (tests[i].mnt_dir);
diff --git a/misc/tst-syslog.c b/misc/tst-syslog.c
index 97aae0d50c..56454f4840 100644
--- a/misc/tst-syslog.c
+++ b/misc/tst-syslog.c
@@ -520,9 +520,7 @@ check_syslog_perror (bool large)
: send_openlog_callback,
&(int){LOG_PERROR});
- FILE *mfp = fmemopen (result.err.buffer, result.err.length, "r");
- if (mfp == NULL)
- FAIL_EXIT1 ("fmemopen: %m");
+ FILE *mfp = xfmemopen (result.err.buffer, result.err.length, "r");
if (large)
check_syslog_console_read_large (mfp);
else