discover: Use mkstemp rather than tempnam