Pull mkstemp() into tempfile.c. That's the only place we use it now, and