From a1e41900441b79275649e1034e958e74bf1ff7db Mon Sep 17 00:00:00 2001 From: John van Groningen Date: Thu, 23 Mar 2006 11:36:44 +0000 Subject: change file mode if stdio is reopened --- wfileIO3.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'wfileIO3.c') diff --git a/wfileIO3.c b/wfileIO3.c index 36958da..d929380 100644 --- a/wfileIO3.c +++ b/wfileIO3.c @@ -450,6 +450,15 @@ static OS(DWORD,ULONG) file_action_reopen[] ={ #endif }; +static int clear_masks_for_stdio_reopen[6]={ + ~ (1<5) @@ -460,6 +469,14 @@ CLEAN_BOOL re_open_file (struct file *f,unsigned int file_mode) IO_error ("freopen: stderr can't be opened for reading"); if (f==&file_table[2]) IO_error ("freopen: file not open"); + if (f==&file_table[1]){ + int m; + + m=file_table[1].file_mode; + m &= clear_masks_for_stdio_reopen[file_mode]; + m |= 1<