X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f Date: Fri, 05 Apr 2002 19:02:33 +0300 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: Richard Dawe Message-Id: <2593-Fri05Apr2002190233+0300-eliz@is.elta.co.il> X-Mailer: emacs 21.2.50 (via feedmail 8 I) and Blat ver 1.8.9 CC: djgpp-workers AT delorie DOT com In-reply-to: <3CAD9FB1.4DEC7F58@phekda.freeserve.co.uk> (message from Richard Dawe on Fri, 05 Apr 2002 13:59:29 +0100) Subject: Re: redirection problem with perl References: <3CAB1FDB DOT 68F9CF2F AT phekda DOT freeserve DOT co DOT uk> <7704-Fri05Apr2002112312+0300-eliz AT is DOT elta DOT co DOT il> <3CAD6FE7 DOT 1384C841 AT phekda DOT freeserve DOT co DOT uk> <8582-Fri05Apr2002142726+0300-eliz AT is DOT elta DOT co DOT il> <3CAD9FB1 DOT 4DEC7F58 AT phekda DOT freeserve DOT co DOT uk> Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > Date: Fri, 05 Apr 2002 13:59:29 +0100 > From: Richard Dawe > > Eli Zaretskii wrote: > [snip] > > I guess that's because you can't create a file without asking to > > write to it. > > That makes sense, but I have no idea if it's true. I'll write a test program > later. Thanks. > But mkstemp should return a file descriptor that can be used for reading and > writing. So perhaps _creatnew should only close and reopen the file, when it > needs to change mode to open the file after creating it? I.e.: > > O_WRONLY -> just open it > O_RDONLY -> open it, close it, re-open it read-only > O_RDWR -> just open it I suggest to postpone the decision until you have time to play with a test program and see if the initial RW open is indeed necessary.