1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-27 04:40:59 +01:00

Use the new gettempfile() function.

This commit is contained in:
Wayne Davison 2004-10-21 00:33:50 +00:00
parent 65729f5570
commit 3ccc3e4bdc
4 changed files with 9 additions and 16 deletions

View file

@ -2801,8 +2801,7 @@ getherestr(struct redir *fn)
untokenize(t);
unmetafy(t, &len);
t[len++] = '\n';
s = gettempname(NULL, 1);
if (!s || (fd = open(s, O_CREAT|O_WRONLY|O_EXCL|O_NOCTTY, 0600)) == -1)
if ((fd = gettempfile(NULL, 1, &s)) < 0)
return -1;
write(fd, t, len);
close(fd);
@ -2975,11 +2974,9 @@ getoutputfile(char *cmd)
return NULL;
if (!(prog = parsecmd(cmd)))
return NULL;
if (!(nam = gettempname(NULL, 1)))
if (!(nam = gettempname(NULL, 0)))
return NULL;
nam = ztrdup(nam);
if (!jobtab[thisjob].filelist)
jobtab[thisjob].filelist = znewlinklist();
zaddlinknode(jobtab[thisjob].filelist, nam);