mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
Fix BZ #18757.
This commit is contained in:
@ -19,6 +19,7 @@
|
||||
|
||||
static char buffer[] = "foobar";
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
@ -30,6 +31,7 @@ do_bz18820 (void)
|
||||
char ch;
|
||||
FILE *stream;
|
||||
|
||||
errno = 0;
|
||||
stream = fmemopen (&ch, 1, "?");
|
||||
if (stream)
|
||||
{
|
||||
@ -37,6 +39,11 @@ do_bz18820 (void)
|
||||
fclose (stream);
|
||||
return 1;
|
||||
}
|
||||
if (errno != EINVAL)
|
||||
{
|
||||
printf ("fmemopen: got %i, expected EINVAL (%i)\n", errno, EINVAL);
|
||||
return 10;
|
||||
}
|
||||
|
||||
stream = fmemopen (NULL, 42, "?");
|
||||
if (stream)
|
||||
@ -46,6 +53,20 @@ do_bz18820 (void)
|
||||
return 2;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
stream = fmemopen (NULL, ~0, "w");
|
||||
if (stream)
|
||||
{
|
||||
printf ("fmemopen: expected NULL, got %p\n", stream);
|
||||
fclose (stream);
|
||||
return 3;
|
||||
}
|
||||
if (errno != ENOMEM)
|
||||
{
|
||||
printf ("fmemopen: got %i, expected ENOMEM (%i)\n", errno, ENOMEM);
|
||||
return 20;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user