bug 855716 - safely handle tmpdir and use lock correctly
Merge pull request #1186 from rhelmer/bug855716-use-mktemp

bug 855716 - safely handle tmpdir and use lock correctly