+ if (tmpdir && *tmpdir) {
+ /* if TMPDIR is set and not empty, we try that first */
+ sv = newSVpv(tmpdir, 0);
+ sv_catpv(sv, tempname + 4);
+ fd = mkstemp(SvPVX(sv));
+ }
+ if (fd < 0) {
+ sv = NULL;
+ /* else we try /tmp */
+ fd = mkstemp(tempname);
+ }