Use a proper mechanism for obtaining a tmpdir.

A small hygiene change.