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-01-01 00:32:25 +00:00
2018-01-19 01:51:10 +01:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-02-07 10:10:32 -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
2015-02-13 15:41:34 -08: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
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-11-13 08:02:52 -08:00
2018-07-16 14:08:27 -07: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-10-02 10:01:56 -03:00
2018-09-04 19:52:06 +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-10-16 22:04:42 +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
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2016-12-26 10:08:41 +01:00
2018-04-04 12:37:23 -04:00
2018-01-01 00:32:25 +00:00
2015-11-06 13:58:53 +01:00
2018-02-01 21:01:00 +00:00
2018-01-25 10:06:19 -08:00
2018-04-04 23:09:37 +01:00
2015-11-06 13:58:53 +01:00
2015-11-06 13:58:53 +01:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-03-25 00:52:39 +01:00
2018-01-01 00:32:25 +00:00
2015-11-06 13:58:53 +01:00
2015-11-06 13:58:53 +01:00
2015-11-06 13:58:53 +01: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-08-09 15:34:12 +00:00
2016-11-04 16:49:06 +00:00
2015-11-06 13:58:53 +01:00
2016-03-07 00:49:36 +01:00
2015-11-06 13:58:53 +01:00
2015-11-06 13:58:53 +01:00
2015-11-06 13:58:53 +01:00
2016-03-07 00:49:36 +01:00
2017-11-13 08:02:52 -08:00
2015-09-04 19:44:27 +00:00
2017-08-10 16:54:57 +02:00
2018-01-01 00:32:25 +00:00
2018-01-28 18:46:23 +01: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-25 10:40:48 -05:00
2018-09-27 20:04:48 +00:00
2018-09-19 10:04:51 +01:00
2018-05-09 19:45:47 +00:00
2018-05-16 06:03:08 +02:00
2018-05-16 06:03:08 +02:00
2018-01-01 00:32:25 +00:00
2018-08-23 23:41:13 +00:00
2018-08-22 12:25:50 +00:00
2018-08-01 11:18:57 +00:00
2018-08-01 11:21:16 +00:00
2018-08-10 19:22:01 +00:00
2018-08-27 18:52:41 +00:00
2018-08-24 19:18:16 +00:00
2018-08-27 18:52:41 +00:00
2018-05-17 15:48:42 +02:00
2018-05-17 15:48:42 +02:00
2018-05-17 15:48:42 +02:00
2018-05-17 15:48:42 +02:00
2018-09-27 20:04:48 +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-06-26 13:22:53 -03: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-03-22 16:40:51 +00:00
2018-01-01 00:32:25 +00:00
2018-01-27 16:45:55 +01:00
2018-01-27 16:47:36 +01:00
2013-09-23 01:44:38 -04:00
2018-01-01 00:32:25 +00:00
2018-01-01 00:32:25 +00:00
2018-02-07 20:33:55 +00:00
2018-02-21 14:11:05 -05:00
2018-01-01 00:32:25 +00:00
2016-12-26 10:11:05 +01:00
2018-01-01 00:32:25 +00:00
2018-03-17 03:17:36 +01:00
2018-01-01 00:32:25 +00:00
2018-07-14 05:56:46 -07:00
2018-03-11 13:06:33 +01:00
2018-01-01 00:32:25 +00:00
2017-03-07 20:52:04 +05:30
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-08-31 18:04:32 -07: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