Add error check for tmpnam function.