Check for mkstemp, added a port implementation if it is not
present. Use mkstemp() in various places needing tmp files.

9 files changed