summaryrefslogtreecommitdiff
path: root/support/htdigest.c
diff options
context:
space:
mode:
authorBradley Nicholes <bnicholes@apache.org>2004-03-17 00:15:12 +0000
committerBradley Nicholes <bnicholes@apache.org>2004-03-17 00:15:12 +0000
commit140a0683fd5b556e270c52c7aa37aebe06da7619 (patch)
treec64504767aa78d6f3828881630edcce8bc82b6b7 /support/htdigest.c
parenta6aee15e5999ff5ab22a4012f7d7b8b40615d589 (diff)
downloadhttpd-140a0683fd5b556e270c52c7aa37aebe06da7619.tar.gz
Remove the dependance on external cp/copy commands
Submitted by: Guenter Knauf <eflash@gmx.net> git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103002 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'support/htdigest.c')
-rw-r--r--support/htdigest.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/support/htdigest.c b/support/htdigest.c
index 56917d5928..d5cd0f04d0 100644
--- a/support/htdigest.c
+++ b/support/htdigest.c
@@ -63,9 +63,9 @@
* we need to close the file before we can copy it.
* otherwise it's locked by the system ;-(
*
- * XXX: Other systems affected? (Netware?, OS2?)
+ * XXX: Other systems affected? (OS2?)
*/
-#if (defined(WIN32))
+#if 0
#define OMIT_DELONCLOSE 1
#endif
@@ -303,18 +303,19 @@ int main(int argc, const char * const argv[])
add_password(user, realm, tfp);
}
apr_file_close(f);
-#if defined(OS2) || defined(WIN32)
- sprintf(command, "copy \"%s\" \"%s\"", dirname, argv[1]);
-#else
- sprintf(command, "cp %s %s", dirname, argv[1]);
-#endif
-
#ifdef OMIT_DELONCLOSE
apr_file_close(tfp);
- system(command);
+#endif
+ /* The temporary file has all the data, just copy it to the new location.
+ */
+ if (apr_file_copy(dirname, argv[1], APR_FILE_SOURCE_PERMS, cntxt) !=
+ APR_SUCCESS) {
+ fprintf(stderr, "%s: unable to update file %s\n",
+ argv[0], argv[1]);
+ }
+#ifdef OMIT_DELONCLOSE
apr_file_remove(dirname, cntxt);
#else
- system(command);
apr_file_close(tfp);
#endif