aboutsummaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
Diffstat (limited to 'libio')
-rw-r--r--libio/freopen.c5
-rw-r--r--libio/freopen64.c4
2 files changed, 3 insertions, 6 deletions
diff --git a/libio/freopen.c b/libio/freopen.c
index ceeff8f..00f26ad 100644
--- a/libio/freopen.c
+++ b/libio/freopen.c
@@ -66,6 +66,7 @@ freopen (const char *filename, const char *mode, FILE *fp)
fp->_flags2 &= ~(_IO_FLAGS2_MMAP
| _IO_FLAGS2_NOTCANCEL
| _IO_FLAGS2_CLOEXEC);
+ fp->_mode = 0;
result = _IO_old_file_fopen (fp, gfilename, mode);
}
else
@@ -78,6 +79,7 @@ freopen (const char *filename, const char *mode, FILE *fp)
fp->_flags2 &= ~(_IO_FLAGS2_MMAP
| _IO_FLAGS2_NOTCANCEL
| _IO_FLAGS2_CLOEXEC);
+ fp->_mode = 0;
result = _IO_file_fopen (fp, gfilename, mode, 1);
if (result != NULL)
result = __fopen_maybe_mmap (result);
@@ -85,9 +87,6 @@ freopen (const char *filename, const char *mode, FILE *fp)
fp->_flags2 &= ~_IO_FLAGS2_NOCLOSE;
if (result != NULL)
{
- /* unbound stream orientation */
- result->_mode = 0;
-
if (fd != -1 && _IO_fileno (result) != fd)
{
/* At this point we have both file descriptors already allocated,
diff --git a/libio/freopen64.c b/libio/freopen64.c
index 3a314ac..77c0dd3 100644
--- a/libio/freopen64.c
+++ b/libio/freopen64.c
@@ -59,15 +59,13 @@ freopen64 (const char *filename, const char *mode, FILE *fp)
fp->_flags2 &= ~(_IO_FLAGS2_MMAP
| _IO_FLAGS2_NOTCANCEL
| _IO_FLAGS2_CLOEXEC);
+ fp->_mode = 0;
result = _IO_file_fopen (fp, gfilename, mode, 0);
fp->_flags2 &= ~_IO_FLAGS2_NOCLOSE;
if (result != NULL)
result = __fopen_maybe_mmap (result);
if (result != NULL)
{
- /* unbound stream orientation */
- result->_mode = 0;
-
if (fd != -1 && _IO_fileno (result) != fd)
{
/* At this point we have both file descriptors already allocated,