Rebased b11326d - tmp_dir param for systems with noexec on /tmp

Fixed b11326d original pull request, whitespacing and rebase done.