After my recent changes to gettempname() and its callers, I decided that it would be nice to have a similar function that works like mkstemp() (and actually uses it, when available). This way callers that are going to do an immediate open() with O_CREAT|O_EXCL can all use the same code, which will hopefully make it easier to ensure that callers don't use mktemp() in an unsafe manner. It also makes things more efficient when mkstemp() is available because that call can avoid the extra lstat() calls that mktemp() uses. The appended patch adds the function gettempfile() that takes the same (pretty new) parameters as gettempname(), plus an extra one that gets set to the pointer for the name (since the function returns a file descriptor). I then sprinkled around the new function into the code. One caller of gettempname() even got changed to ask for non-heap memory instead of calling ztrdup() on the returned heap string. ..wayne..