remove mktemp usage

mktemp is insecure, by the time the generated filename is used someone
else might have modified it.
Merge pull request #5166 from juliantaylor/mktemp-remove

remove mktemp usage