delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/06/13/11:38:41

Message-Id: <200006131530.LAA10059@qnx.com>
Subject: Re: tmpfile in DJGPP
To: djgpp-workers AT delorie DOT com
Date: Tue, 13 Jun 2000 11:30:00 -0400 (EDT)
From: "Alain Magloire" <alain AT qnx DOT com>
In-Reply-To: <Pine.SUN.3.91.1000613133639.16888X-100000@is> from "Eli Zaretskii" at Jun 13, 2000 01:36:54 PM
X-Mailer: ELM [version 2.5 PL0b1]
MIME-Version: 1.0
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

> 
> 
> On Mon, 12 Jun 2000, Mark E. wrote:
> 
> > Perhaps we should stick to considering how to handle properly-
> > written programs that make use of temporary files like Bash.
> 
> If you mean that Bash should use tmpfile() instead of what it does
> now, then I'm for it.  IMHO, getting remove-while-open do the right
> thing on DOS (see my other mail) is too much of a hassle.  And the
> trick Bash (and other Unix programs) use is inherently non-portable,

Well Eli, I think I have to disagree, non-portable according to what ?

> so I think it's a good idea to remove it even on Unix.

open()/unlink()/close() are very well documented in POSIX.
unlink() remove the pathname, but removal of the file contents is
delayed until all references have been closed.

True, ANSI C, tmpfile() does not go that far, but for POSIX it's clear,

There are good reasons not to use tmpfile(); because of security risks:
- you don't control the mode
- the policy not to follow symlinks
- race conditions 
- etc ...


-- 
au revoir, alain
----
Aussi haut que l'on soit assis, on n'est toujours assis que sur son cul !!!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019