Changes didn't account the case when mkdtemp failed. Previously the copying the string wasn't needed in this case.