summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1999-06-04 22:15:56 +0000
committerderaadt <deraadt@openbsd.org>1999-06-04 22:15:56 +0000
commitaa72b7b55fcffb1e98eb46c973e9c66ed10005db (patch)
treec41820314eb53d4cdb51e34bc64c0113614e0ce0
parentquiet gcc (diff)
downloadwireguard-openbsd-aa72b7b55fcffb1e98eb46c973e9c66ed10005db.tar.xz
wireguard-openbsd-aa72b7b55fcffb1e98eb46c973e9c66ed10005db.zip
use mkstemp; Peter.Galbavy@knowledge.com
-rw-r--r--usr.sbin/httpd/src/modules/proxy/proxy_cache.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/usr.sbin/httpd/src/modules/proxy/proxy_cache.c b/usr.sbin/httpd/src/modules/proxy/proxy_cache.c
index a33d9000861..035a4c444c1 100644
--- a/usr.sbin/httpd/src/modules/proxy/proxy_cache.c
+++ b/usr.sbin/httpd/src/modules/proxy/proxy_cache.c
@@ -999,19 +999,15 @@ int ap_proxy_cache_update(cache_req *c, table *resp_hdrs,
strcpy(c->tempfile, conf->cache.root);
strcat(c->tempfile, TMPFILESTR);
#undef TMPFILESTR
- p = mktemp(c->tempfile);
- if (p == NULL)
- return DECLINED;
-
- Explain1("Create temporary file %s", c->tempfile);
-
- i = open(c->tempfile, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, 0622);
+ i = mkstemp(c->tempfile);
if (i == -1) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
"proxy: error creating cache file %s",
c->tempfile);
return DECLINED;
}
+ (void) fchmod(i, 0622);
+
ap_note_cleanups_for_fd(r->pool, i);
c->fp = ap_bcreate(r->pool, B_WR);
ap_bpushfd(c->fp, -1, i);