aboutsummaryrefslogtreecommitdiff
path: root/stdio-common
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.com>2015-07-15 16:15:47 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.com>2015-07-16 15:21:49 -0300
commit787813b14425c9c2e699a90e27eee1cfdfe73ec2 (patch)
tree8fb22cea093163f6706988781a5eb6012dd442e1 /stdio-common
parentb42f8cad52ebfbfd43ebf6e42e606b489ffbd466 (diff)
downloadglibc-787813b14425c9c2e699a90e27eee1cfdfe73ec2.tar
glibc-787813b14425c9c2e699a90e27eee1cfdfe73ec2.tar.gz
glibc-787813b14425c9c2e699a90e27eee1cfdfe73ec2.tar.bz2
glibc-787813b14425c9c2e699a90e27eee1cfdfe73ec2.zip
libio: Fix fmemopen 'w' mode with provided buffer
If 'w' mode is used with a provided buffer the fmemopen will try to find the first null byte to set as maximum internal stream size. It should be done only for append mode ('a'). Kudos for Stefan Liebler for finding this error on s390-32. * libio/fmemopen.c (__fmemopen): Fix 'w' openmode with provided buffer. * stdio-common/tst-fmemopen2.c (do_test_with_buffer): Fix typo and fail output information.
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/tst-fmemopen2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/stdio-common/tst-fmemopen2.c b/stdio-common/tst-fmemopen2.c
index 16dd3ad73d..a2c05c12df 100644
--- a/stdio-common/tst-fmemopen2.c
+++ b/stdio-common/tst-fmemopen2.c
@@ -34,7 +34,7 @@ do_test_with_buffer (void)
FILE *fp = fmemopen (buf, nbuf, "w");
if (fp == NULL)
{
- printf ("FAIL: fmemopen failedi (%s)\n", __FUNCTION__);
+ printf ("FAIL: fmemopen failed (%s)\n", __FUNCTION__);
return 1;
}
@@ -69,7 +69,7 @@ do_test_with_buffer (void)
if (o != nstr)
{
printf ("FAIL: third ftello returned %jd, expected %zu\n",
- (intmax_t)o, nbuf);
+ (intmax_t)o, nstr);
result = 1;
}