summaryrefslogtreecommitdiff
path: root/support/htdigest.c
diff options
context:
space:
mode:
authorBradley Nicholes <bnicholes@apache.org>2004-03-17 00:04:35 +0000
committerBradley Nicholes <bnicholes@apache.org>2004-03-17 00:04:35 +0000
commit5095c3880cd386864accbdafd63fef3b442448e9 (patch)
treea3439f63b093fa1169645f0091f24b6f56f0d721 /support/htdigest.c
parent678376c6a4a8ef0e8ff1c10d6e899bb6ccd07b3c (diff)
downloadhttpd-5095c3880cd386864accbdafd63fef3b442448e9.tar.gz
Use apr_temp_dir_get() to get the temporary directory
Submitted by: Guenter Knauf <eflash@gmx.net> git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@102998 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'support/htdigest.c')
-rw-r--r--support/htdigest.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/support/htdigest.c b/support/htdigest.c
index e0801b1687..56917d5928 100644
--- a/support/htdigest.c
+++ b/support/htdigest.c
@@ -208,6 +208,7 @@ int main(int argc, const char * const argv[])
apr_file_t *f;
apr_status_t rv;
char tn[] = "htdigest.tmp.XXXXXX";
+ char *dirname;
char user[MAX_STRING_LEN];
char realm[MAX_STRING_LEN];
char line[MAX_STRING_LEN];
@@ -251,7 +252,14 @@ int main(int argc, const char * const argv[])
else if (argc != 4)
usage();
- if (apr_file_mktemp(&tfp, tn,
+ if (apr_temp_dir_get((const char**)&dirname, cntxt) != APR_SUCCESS) {
+ fprintf(stderr, "%s: could not determine temp dir\n",
+ argv[0]);
+ exit(1);
+ }
+ dirname = apr_psprintf(cntxt, "%s/%s", dirname, tn);
+
+ if (apr_file_mktemp(&tfp, dirname,
#ifdef OMIT_DELONCLOSE
APR_CREATE | APR_READ | APR_WRITE | APR_EXCL
#else
@@ -296,15 +304,15 @@ int main(int argc, const char * const argv[])
}
apr_file_close(f);
#if defined(OS2) || defined(WIN32)
- sprintf(command, "copy \"%s\" \"%s\"", tn, argv[1]);
+ sprintf(command, "copy \"%s\" \"%s\"", dirname, argv[1]);
#else
- sprintf(command, "cp %s %s", tn, argv[1]);
+ sprintf(command, "cp %s %s", dirname, argv[1]);
#endif
#ifdef OMIT_DELONCLOSE
apr_file_close(tfp);
system(command);
- apr_file_remove(tn, cntxt);
+ apr_file_remove(dirname, cntxt);
#else
system(command);
apr_file_close(tfp);