libio: Fix fmemopen 'w' mode with provided buffer
commit787813b14425c9c2e699a90e27eee1cfdfe73ec2
authorAdhemerval Zanella <adhemerval.zanella@linaro.com>
Wed, 15 Jul 2015 19:15:47 +0000 (15 16:15 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.com>
Thu, 16 Jul 2015 18:21:49 +0000 (16 15:21 -0300)
tree8fb22cea093163f6706988781a5eb6012dd442e1
parentb42f8cad52ebfbfd43ebf6e42e606b489ffbd466
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.
ChangeLog
libio/fmemopen.c
stdio-common/tst-fmemopen2.c