Mail Archives: djgpp-workers/2000/06/13/11:38:41
>
>
> 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 -