diff options
author | Paul Pluzhnikov <ppluzhnikov@google.com> | 2015-09-01 08:48:15 -0700 |
---|---|---|
committer | Paul Pluzhnikov <ppluzhnikov@google.com> | 2015-09-01 08:48:15 -0700 |
commit | 2d8e36e691f460aeeb3362fd44c71cafc7bb5852 (patch) | |
tree | 945a622e0b51a2e7ff758269a60a6d5ef1417479 /libio/test-fmemopen.c | |
parent | 74589f738efd72e07f759a4aabd2e32613aaefb8 (diff) | |
download | glibc-2d8e36e691f460aeeb3362fd44c71cafc7bb5852.tar glibc-2d8e36e691f460aeeb3362fd44c71cafc7bb5852.tar.gz glibc-2d8e36e691f460aeeb3362fd44c71cafc7bb5852.tar.bz2 glibc-2d8e36e691f460aeeb3362fd44c71cafc7bb5852.zip |
Fix BZ #18757.
Diffstat (limited to 'libio/test-fmemopen.c')
-rw-r--r-- | libio/test-fmemopen.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libio/test-fmemopen.c b/libio/test-fmemopen.c index e8e757f351..a62f6644c2 100644 --- a/libio/test-fmemopen.c +++ b/libio/test-fmemopen.c @@ -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; } |