diff options
author | Wayne Davison <wayned@users.sourceforge.net> | 2004-10-21 00:33:50 +0000 |
---|---|---|
committer | Wayne Davison <wayned@users.sourceforge.net> | 2004-10-21 00:33:50 +0000 |
commit | 3ccc3e4bdcaed42c72e6b22c1306518458778541 (patch) | |
tree | a420f6a525ed82316b35f9d349c1736d6073251e /Src/builtin.c | |
parent | 65729f55704b22dbe781bd826a852bfe48b3e8e1 (diff) | |
download | zsh-3ccc3e4bdcaed42c72e6b22c1306518458778541.tar.gz zsh-3ccc3e4bdcaed42c72e6b22c1306518458778541.tar.xz zsh-3ccc3e4bdcaed42c72e6b22c1306518458778541.zip |
Use the new gettempfile() function.
Diffstat (limited to 'Src/builtin.c')
-rw-r--r-- | Src/builtin.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Src/builtin.c b/Src/builtin.c index dcf856cc1..bc21fa9e2 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -1445,10 +1445,8 @@ bin_fc(char *nam, char **argv, Options ops, int func) char *fil; retval = 1; - fil = gettempname(NULL, 1); - if (((tempfd = open(fil, O_WRONLY | O_CREAT | O_EXCL | O_NOCTTY, 0600)) - == -1) || - ((out = fdopen(tempfd, "w")) == NULL)) { + if ((tempfd = gettempfile(NULL, 1, &fil)) < 0 + || ((out = fdopen(tempfd, "w")) == NULL)) { unqueue_signals(); zwarnnam("fc", "can't open temp file: %e", NULL, errno); } else { @@ -3535,8 +3533,8 @@ bin_print(char *name, char **args, Options ops, int func) zwarnnam(name, "open_memstream failed", NULL, 0); #else int tempfd; - char *tmpf = gettempname(NULL, 1); - if ((tempfd = open(tmpf, O_RDWR|O_CREAT|O_EXCL, 0644)) < 0 + char *tmpf; + if ((tempfd = gettempfile(NULL, 1, &tmpf)) < 0 || (fout = fdopen(tempfd, "w+")) == NULL) zwarnnam(name, "can't open temp file: %e", NULL, errno); unlink(tmpf); |