Changed tmpname(2) to mkdtemp(1)