do proper call to mkstemp()