Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: O_EXCL (was: How about MODDIR being configure'able?)



On Mon, 15 Oct 2001, Clint Adams wrote:
> Hmm.. shouldn't that be O_CREAT|O_EXCL, which we're not doing in
> all cases?

You are right that O_EXCL (when combined with O_CREAT) is the vital
part of the incantation when creating new temp files, but it is not an
error that some of our open() calls that include O_CREAT do not use
O_EXCL.  For instance, the calls that write out the history file need
to succeed even if the file already exists, but they also want to
succeed when the file doesn't exist.  This is not a security problem
since (sane) people put their history file into their home dir (or
another non-world-writable dir) which is not vulnerable to the "rogue
symlink" exploit.  The code that creates a file based on the return of
mktemp() is all using O_EXCL, so we're OK.

..wayne..



Messages sorted by: Reverse Date, Date, Thread, Author