Date: Mon, 6 Aug 2001 09:49:12 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: djgpp AT delorie DOT com Subject: Re: files not closed after GPF In-Reply-To: <9kjsnd$ian$1@newsg3.svr.pol.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sun, 5 Aug 2001, Matthew Smith wrote: > If your program was opening the file itself, it could adopt an > "open,append,close quickly" strategy but redirecting the output makes > your shell handle this. Are you saying that because of redirection this cannot work? Of course, it can: use `dup' to save the original handle's connection, close the original handle, then use `dup2' to restore the original handle. But it's much better to use `fsync' instead, since it has the same effect as `close', without actually closing the handle.