[clang-warning-fix][tmpnam-dangerous]

Clang 3.5 reports using tmpnam() as dangerous and to use mkstemp() instead. I believe this change will produce the same behavior as the original code but not 100% sure as I'm not very familiar with POSIX-only functions.