/* Some hooks are called more than once but the test only check if any
is called at least once. */
- FILE *out = fmemopen (result.err.buffer, result.err.length, "r");
- TEST_VERIFY (out != NULL);
+ FILE *out = xfmemopen (result.err.buffer, result.err.length, "r");
char *buffer = NULL;
size_t buffer_length = 0;
while (xgetline (&buffer, &buffer_length, out))
bool find_symbind = false;
- FILE *out = fmemopen (result.err.buffer, result.err.length, "r");
- TEST_VERIFY (out != NULL);
+ FILE *out = xfmemopen (result.err.buffer, result.err.length, "r");
char *buffer = NULL;
size_t buffer_length = 0;
while (xgetline (&buffer, &buffer_length, out))
bool vdso_audit_found = false;
uintptr_t vdso_audit = 0;
- FILE *out = fmemopen (result.err.buffer, result.err.length, "r");
- TEST_VERIFY (out != NULL);
+ FILE *out = xfmemopen (result.err.buffer, result.err.length, "r");
char *buffer = NULL;
size_t buffer_length = 0;
while (xgetline (&buffer, &buffer_length, out))
support_capture_subprocess_check (&result, "tst-audit22", 0, sc_allow_stderr);
{
- FILE *fp = fmemopen (result.err.buffer, result.err.length, "r");
- TEST_VERIFY (fp != NULL);
+ FILE *fp = xfmemopen (result.err.buffer, result.err.length, "r");
unsigned int line = 0;
char *buffer = NULL;
size_t buffer_length = 0;
uintptr_t last_act_cookie = -1;
bool seen_first_objclose = false;
- FILE *out = fmemopen (result.err.buffer, result.err.length, "r");
- TEST_VERIFY (out != NULL);
+ FILE *out = xfmemopen (result.err.buffer, result.err.length, "r");
char *buffer = NULL;
size_t buffer_length = 0;
unsigned int line = 0;
static void
compare_output (void *buffer, size_t length, const char *ref[], size_t reflen)
{
- FILE *in = fmemopen (buffer, length, "r");
- TEST_VERIFY_EXIT (in != NULL);
+ FILE *in = xfmemopen (buffer, length, "r");
char *line = NULL;
size_t linelen = 0;
#include <support/check.h>
#include <support/support.h>
#include <support/xptrace.h>
+#include <support/xstdio.h>
#include <support/xunistd.h>
#include <sys/mman.h>
#include <errno.h>
#define STRINPUT(size) XSTRINPUT(size)
#define XSTRINPUT(size) "%" # size "s"
- FILE *out = fmemopen (pldd.out.buffer, pldd.out.length, "r");
- TEST_VERIFY (out != NULL);
+ FILE *out = xfmemopen (pldd.out.buffer, pldd.out.length, "r");
/* First line is in the form of <pid>: <full path of executable> */
TEST_COMPARE (fscanf (out, "%u: " STRINPUT (BUFFERLEN), &pid, buffer), 2);
#include <support/check.h>
#include <support/support.h>
#include <support/test-driver.h>
+#include <support/xstdio.h>
static int
do_test (void)
char *lineptr = NULL;
size_t linelen = 0;
char membuf[] = "abc\0d\nef\0";
- FILE *memstream = fmemopen (membuf, sizeof (membuf), "r");
- TEST_VERIFY_EXIT (memstream != NULL);
+ FILE *memstream = xfmemopen (membuf, sizeof (membuf), "r");
TEST_VERIFY (getdelim (&lineptr, &linelen, '\0', memstream) != -1);
TEST_COMPARE_BLOB (lineptr, 4, "abc\0", 4);
TEST_VERIFY (getdelim (&lineptr, &linelen, '\0', memstream) != -1);
memcpy (ntfi.buffer, s, sizeof (s));
ic = i = 0;
- f = fmemopen (b, sizeof (s), "r");
- if (f == NULL)
- FAIL_EXIT1 ("fmemopen: %m");
+ f = xfmemopen (b, sizeof (s), "r");
c = e - 1;
TEST_VERIFY_EXIT (ftell (f) == i);
xfclose (f);
ic = i = 0;
- f = fmemopen (b, 3, "r");
- if (f == NULL)
- FAIL_EXIT1 ("fmemopen: %m");
+ f = xfmemopen (b, 3, "r");
c = e - 2;
TEST_VERIFY_EXIT (ftell (f) == i);
xfclose (f);
ic = i = 0;
- f = fmemopen (b, 3, "r");
- if (f == NULL)
- FAIL_EXIT1 ("fmemopen: %m");
+ f = xfmemopen (b, 3, "r");
c = e - 1;
TEST_VERIFY_EXIT (ftell (f) == i);
#include <libc-diag.h>
#include <support/check.h>
+#include <support/xstdio.h>
#define PD "\xd9\xab"
FAIL_EXIT1 ("setlocale (LC_ALL, \"fa_IR.UTF-8\")");
char s[] = "+" PD "e";
- FILE *f = fmemopen (s, strlen (s), "r");
+ FILE *f = xfmemopen (s, strlen (s), "r");
/* Avoid: "warning: 'I' flag used with '%f' gnu_scanf format [-Wformat=]";
cf. GCC PR c/119514. */
#include <libc-diag.h>
#include <support/check.h>
+#include <support/xstdio.h>
#define P1 "\xdb\xb1"
#define P2 "\xdb\xb2"
FAIL_EXIT1 ("setlocale (LC_ALL, \"fa_IR.UTF-8\")");
char s[] = P1 P2;
- FILE *f = fmemopen (s, strlen (s), "r");
- if (f == NULL)
- FAIL_EXIT1 ("fmemopen: %m");
+ FILE *f = xfmemopen (s, strlen (s), "r");
/* Avoid: "warning: 'I' flag used with '%f' gnu_scanf format [-Wformat=]";
cf. GCC PR c/119514. */
#include <libc-diag.h>
#include <support/check.h>
+#include <support/xstdio.h>
#define PD "\xd9\xab"
FAIL_EXIT1 ("setlocale (LC_ALL, \"ps_AF.UTF-8\")");
char s[] = "1" PD;
- FILE *f = fmemopen (s, strlen (s), "r");
- if (f == NULL)
- FAIL_EXIT1 ("fmemopen: %m");
+ FILE *f = xfmemopen (s, strlen (s), "r");
/* This should succeed parsing a floating-point number, and leave '\xd9',
'\xab' in the input. */
#include <stdio.h>
#include <string.h>
#include <support/check.h>
+#include <support/xstdio.h>
struct const_mntent
{
{
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);
: 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
#include <stdio.h>
#include <string.h>
+#include <support/xstdio.h>
+
int
main (void)
{
double d;
char s[] = "+.e";
- f = fmemopen (s, strlen (s), "r");
+ f = xfmemopen (s, strlen (s), "r");
/* This should fail to parse a floating-point number, and leave 'e' in the
input. */
lost |= (fscanf (f, "%lf", &d) != 0);
memcpy (ntfi.buffer, s, sizeof (s));
i = 0;
- f = fmemopen (b, sizeof (s), "r");
- if (f == NULL)
- FAIL_EXIT1 ("fmemopen: %m");
+ f = xfmemopen (b, sizeof (s), "r");
c = e - 1;
TEST_VERIFY_EXIT (ftell (f) == i);
xfclose (f);
i = 0;
- f = fmemopen (b, 3, "r");
- if (f == NULL)
- FAIL_EXIT1 ("fmemopen: %m");
+ f = xfmemopen (b, 3, "r");
c = e - 1;
TEST_VERIFY_EXIT (ftell (f) == i);
xfclose (f);
i = 0;
- f = fmemopen (b, 3, "r");
- if (f == NULL)
- FAIL_EXIT1 ("fmemopen: %m");
+ f = xfmemopen (b, 3, "r");
c = e - 2;
TEST_VERIFY_EXIT (ftell (f) == i);
https://sourceware.org/bugzilla/show_bug.cgi?id=713. */
#include <stdio.h>
+#include <support/xstdio.h>
+
static int
do_test (void)
{
- FILE *fp = fmemopen ((char *) "hello", 5, "r");
+ FILE *fp = xfmemopen ((char *) "hello", 5, "r");
char buf[2];
char *bp = fgets (buf, sizeof (buf), fp);
printf ("fgets: %s\n", bp == buf ? "OK" : "ERROR");