So I'm clear, here's what I suggest. Two new functions, one existing:
// Returns a valid scratch dir (system-defined, eg /tmp) apr_status_t apr_file_get_temp_directory(char** path, apr_pool_t *p);
// Creates new file with a template, returns handle
// (This already exists in apr_file_io.h)
// (Should this take an apr_fileperms_t for flags?)
apr_status_t apr_file_mktemp(apr_file_t **fp, char *templ, apr_int32_t flags, apr_pool_t *p);
// Creates new directory with a template, returns handle
apr_status_t apr_dir_mktemp(char **path, char *templ, apr_fileperms_t perm, apr_pool_t *p);
/* no apr_temp_get_unique */
-wsv