Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ``mktemp() possibly used unsafely''
- X-seq: zsh-workers 3927
- From: mason@xxxxxxxxxxxxxxx (Geoff Wing)
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Re: ``mktemp() possibly used unsafely''
- Date: 5 May 1998 02:59:16 GMT
- Organization: PrimeNet Computer Consultants
- References: <199805050231.WAA27346@xxxxxxxxxxxxxxx>
- Reply-to: mason@xxxxxxxxxxxxxxx
Timothy J Luoma <luomat+Lists/Zsh/workers@xxxxxxxxxxxxxxx> typed:
:I just compiled 3.05 on a NetBSD 1.3 machine and saw this warning:
:utils.o: warning: mktemp() possibly used unsafely, consider using mkstemp ()
:What is the danger here? How do I change to mkstemp ?
mkstemp() atomically creates the temporary file, whereas when using mktemp()
someone could create a file of the same name between calling mktemp() and
creating that file.
When zsh uses mktemp() it open()s those files with flags O_CREAT and O_EXCL
or runs mkfifo()/mknod() on it, and it's not a problem for us since we
properly check the return values (I believe), so we don't need to change
anything here.
--
Geoff Wing <gcw@xxxxxxxxx> Mobile : 0412 162 441
Work URL: http://www.primenet.com.au/ Ego URL: http://pobox.com/~gcw/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author