joes 2004/06/14 21:32:08
Modified: src apreq.c
Log:
Simplify apreq_file_mktemp implementation.
Revision Changes Path
1.36 +8 -10 httpd-apreq-2/src/apreq.c
Index: apreq.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/src/apreq.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- apreq.c 15 Jun 2004 04:18:27 -0000 1.35
+++ apreq.c 15 Jun 2004 04:32:08 -0000 1.36
@@ -682,19 +682,17 @@
{
apr_status_t rc = APR_SUCCESS;
char *tmpl;
- if (path) {
- rc = apr_filepath_merge(&tmpl, path, "apreqXXXXXX",
- APR_FILEPATH_NOTRELATIVE, pool);
+
+ if (path == NULL) {
+ rc = apr_temp_dir_get(&path, pool);
if (rc != APR_SUCCESS)
return rc;
}
- else {
- const char *tdir;
- rc = apr_temp_dir_get(&tdir, pool);
- if (rc != APR_SUCCESS)
- return rc;
- tmpl = apr_pstrcat(pool, tdir, "XXXXXX", NULL);
- }
+ rc = apr_filepath_merge(&tmpl, path, "apreqXXXXXX",
+ APR_FILEPATH_NOTRELATIVE, pool);
+
+ if (rc != APR_SUCCESS)
+ return rc;
return apr_file_mktemp(fp, tmpl,
APR_CREATE | APR_READ | APR_WRITE