Adhemerval Zanella
0b727ed4d6
libio: Flush stream at freopen (BZ#21037)
...
As POSIX states [1] a freopen call should first flush the stream as if by a
call fflush. C99 (n1256) and C11 (n1570) only states the function should
first close any file associated with the specific stream. Although current
implementation only follow C specification, current BSD and other libc
implementation (musl) are in sync with POSIX and fflush the stream.
This patch change freopen{64} to fflush the stream before actually reopening
it (or returning if the stream does not support reopen). It also changes the
Linux implementation to avoid a dynamic allocation on 'fd_to_filename'.
Checked on x86_64-linux-gnu.
[BZ #21037 ]
* libio/Makefile (tests): Add tst-memstream4 and tst-wmemstream4.
* libio/freopen.c (freopen): Sync stream before reopen and adjust to
new fd_to_filename interface.
* libio/freopen64.c (freopen64): Likewise.
* libio/tst-memstream.h: New file.
* libio/tst-memstream4.c: Likewise.
* libio/tst-wmemstream4.c: Likewise.
* sysdeps/generic/fd_to_filename.h (fd_to_filename): Change signature.
* sysdeps/unix/sysv/linux/fd_to_filename.h (fd_to_filename): Likewise
and remove internal dynamic allocation.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/
2018-10-02 10:01:56 -03:00
..
2018-02-21 14:22:50 -05:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-02-16 17:33:18 -05:00
2014-11-26 12:54:39 +00:00
2014-11-26 12:54:39 +00:00
2018-01-01 00:32:25 +00:00
2014-11-27 16:01:04 +00:00
2017-02-16 17:33:18 -05:00
2018-01-01 00:32:25 +00:00
2018-02-21 14:39:54 -05:00
2018-01-01 00:32:25 +00:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-03-13 08:31:56 -04:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:39:54 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-10-02 10:01:56 -03:00
2018-10-02 10:01:56 -03:00
2018-02-21 14:11:05 -05:00
2018-07-06 17:52:54 +02:00
2018-07-06 17:52:54 +02:00
2018-07-06 17:52:54 +02:00
2018-07-06 17:52:54 +02:00
2018-02-21 14:11:05 -05:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-02-21 14:39:54 -05:00
2018-02-21 18:01:11 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-02-21 14:39:54 -05:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-02-21 14:22:50 -05:00
2018-02-21 14:39:54 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:22:50 -05:00
2018-02-21 14:22:50 -05:00
2018-02-21 14:22:50 -05:00
2018-02-21 14:22:50 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:13:21 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:39:54 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:22:50 -05:00
2018-02-21 14:11:05 -05:00
2018-04-03 00:36:33 +00:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:13:21 -05:00
2018-04-03 00:36:33 +00:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:22:50 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:13:21 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-01-01 00:32:25 +00:00
2018-02-21 14:39:54 -05:00
2018-06-20 09:45:19 +02:00
2018-10-02 10:01:56 -03:00
2018-06-01 10:41:03 +02:00
2018-02-21 14:11:05 -05:00
2018-03-13 08:31:56 -04:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:22:50 -05:00
2018-02-21 14:39:54 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:13:21 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:13:21 -05:00
2018-02-21 14:39:54 -05:00
2018-02-21 14:11:05 -05:00
2018-01-01 00:32:25 +00:00
2018-02-21 14:39:54 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-07-10 11:03:08 +02:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-01-01 00:32:25 +00:00
2018-02-21 14:11:05 -05:00
2018-07-05 19:00:10 +02:00
2018-06-01 10:41:03 +02:00
2018-06-01 10:41:03 +02:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2015-10-12 15:18:08 +02:00
2015-02-06 12:24:16 -08:00
2018-01-01 00:32:25 +00:00
2018-03-13 08:31:56 -04:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2017-02-16 17:33:18 -05:00
2017-02-16 17:33:18 -05:00
2018-01-29 23:00:17 +01:00
2018-10-02 10:01:56 -03:00
2018-10-02 10:01:56 -03:00
2016-06-11 14:50:16 -07:00
2018-02-21 14:39:54 -05:00
2018-01-01 00:32:25 +00:00
2018-07-10 11:03:08 +02:00
2018-06-26 12:31:08 +02:00
2018-06-26 12:31:08 +02:00
2018-06-26 12:31:08 +02:00
2018-01-01 00:32:25 +00:00
2017-09-09 12:41:54 +02:00
2018-01-29 23:00:17 +01:00
2018-10-02 10:01:56 -03:00
2018-06-01 10:41:03 +02:00
2018-07-06 17:52:54 +02:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-06-26 10:24:52 +02:00
2018-01-01 00:32:25 +00:00
2018-02-21 14:11:05 -05:00
2018-02-21 14:11:05 -05:00
2018-03-13 08:31:56 -04:00
2018-02-21 14:39:54 -05:00
2018-06-01 10:41:03 +02:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-06-01 10:41:03 +02:00