Fix mktmp to be generic as-per SUS/BSD

See:
https://github.com/Homebrew/linuxbrew/issues/26
for discussion.