You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@apache.org on 2002/01/08 07:26:10 UTC
cvs commit: httpd-2.0/support htdigest.c
rbb 02/01/07 22:26:10
Modified: modules/arch/win32 mod_isapi.c
modules/generators mod_cgid.c
file_io/os2 open.c
file_io/unix mktemp.c open.c
file_io/win32 open.c
include apr_file_io.h apr_portable.h
locks/unix locks.c proc_mutex.c
shmem/unix shmem.c
support htdigest.c
Log:
Add the ability to pass flags to both apr_file_open and apr_mktemp.
The reason for this, is that it is very possible to want a temp
file that isn't deleted when the file is closed. It also makes sense
to have the flags in the apr_file_t if possible.
Revision Changes Path
1.56 +1 -1 httpd-2.0/modules/arch/win32/mod_isapi.c
Index: mod_isapi.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/arch/win32/mod_isapi.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- mod_isapi.c 13 Dec 2001 17:22:19 -0000 1.55
+++ mod_isapi.c 8 Jan 2002 06:26:09 -0000 1.56
@@ -892,7 +892,7 @@
return FALSE;
}
- if ((rv = apr_os_file_put(&fd, tf->hFile, r->pool)) != APR_SUCCESS) {
+ if ((rv = apr_os_file_put(&fd, tf->hFile, 0, r->pool)) != APR_SUCCESS) {
return FALSE;
}
1.110 +4 -4 httpd-2.0/modules/generators/mod_cgid.c
Index: mod_cgid.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgid.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -r1.109 -r1.110
--- mod_cgid.c 31 Dec 2001 05:58:59 -0000 1.109
+++ mod_cgid.c 8 Jan 2002 06:26:09 -0000 1.110
@@ -531,8 +531,8 @@
procnew = apr_pcalloc(ptrans, sizeof(*procnew));
r->pool = ptrans;
get_req(sd2, r, &argv0, &env, &req_type);
- apr_os_file_put(&r->server->error_log, &errfileno, r->pool);
- apr_os_file_put(&inout, &sd2, r->pool);
+ apr_os_file_put(&r->server->error_log, &errfileno, 0, r->pool);
+ apr_os_file_put(&inout, &sd2, 0, r->pool);
if (req_type == SSI_REQ) {
in_pipe = APR_NO_PIPE;
@@ -941,7 +941,7 @@
/* We are putting the tempsock variable into a file so that we can use
* a pipe bucket to send the data to the client.
*/
- apr_os_file_put(&tempsock, &sd, r->pool);
+ apr_os_file_put(&tempsock, &sd, 0, r->pool);
if ((retval = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)))
return retval;
@@ -1208,7 +1208,7 @@
/* We are putting the tempsock variable into a file so that we can use
* a pipe bucket to send the data to the client.
*/
- apr_os_file_put(&tempsock, &sd, r->pool);
+ apr_os_file_put(&tempsock, &sd, 0, r->pool);
if ((retval = ap_setup_client_block(r, REQUEST_CHUNKED_ERROR)))
return retval;
1.48 +5 -5 apr/file_io/os2/open.c
Index: open.c
===================================================================
RCS file: /home/cvs/apr/file_io/os2/open.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- open.c 30 Dec 2001 14:30:58 -0000 1.47
+++ open.c 8 Jan 2002 06:26:09 -0000 1.48
@@ -213,7 +213,7 @@
-APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, apr_os_file_t *thefile, apr_pool_t *cont)
+APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, apr_os_file_t *thefile, apr_int32_t flags, apr_pool_t *cont)
{
apr_os_file_t *dafile = thefile;
@@ -223,7 +223,7 @@
(*file)->isopen = TRUE;
(*file)->buffered = FALSE;
(*file)->eof_hit = FALSE;
- (*file)->flags = 0;
+ (*file)->flags = flags;
(*file)->pipe = FALSE;
return APR_SUCCESS;
}
@@ -242,7 +242,7 @@
{
apr_os_file_t fd = 2;
- return apr_os_file_put(thefile, &fd, cont);
+ return apr_os_file_put(thefile, &fd, 0, cont);
}
@@ -251,7 +251,7 @@
{
apr_os_file_t fd = 1;
- return apr_os_file_put(thefile, &fd, cont);
+ return apr_os_file_put(thefile, &fd, 0, cont);
}
@@ -259,7 +259,7 @@
{
apr_os_file_t fd = 0;
- return apr_os_file_put(thefile, &fd, cont);
+ return apr_os_file_put(thefile, &fd, 0, cont);
}
APR_POOL_IMPLEMENT_ACCESSOR_X(file, cntxt);
1.17 +6 -11 apr/file_io/unix/mktemp.c
Index: mktemp.c
===================================================================
RCS file: /home/cvs/apr/file_io/unix/mktemp.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- mktemp.c 28 Dec 2001 22:33:53 -0000 1.16
+++ mktemp.c 8 Jan 2002 06:26:09 -0000 1.17
@@ -120,7 +120,7 @@
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
static apr_uint32_t randseed=0;
-static int gettemp(char *path, apr_file_t **doopen, apr_pool_t *p)
+static int gettemp(char *path, apr_file_t **doopen, apr_int32_t flags, apr_pool_t *p)
{
register char *start, *trv, *suffp;
char *pad;
@@ -168,8 +168,7 @@
}
for (;;) {
- if ((rv = apr_file_open(doopen, path, APR_CREATE|APR_EXCL|APR_READ|
- APR_WRITE|APR_DELONCLOSE,
+ if ((rv = apr_file_open(doopen, path, flags,
APR_UREAD | APR_UWRITE, p)) == APR_SUCCESS)
return APR_SUCCESS;
if (rv != APR_EEXIST)
@@ -202,24 +201,20 @@
#endif
#endif /* !defined(HAVE_MKSTEMP) */
-APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *template, apr_pool_t *p)
+APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *template, apr_int32_t flags, apr_pool_t *p)
{
+ flags = (!flags) ? APR_READ | APR_WRITE | APR_EXCL | APR_DELONCLOSE : flags;
#ifndef HAVE_MKSTEMP
- return gettemp(template, fp, p);
+ return gettemp(template, fp, flags, p);
#else
int fd;
- (*fp) = apr_pcalloc(p, sizeof(**fp));
- (*fp)->cntxt = p;
- (*fp)->timeout = -1;
- (*fp)->blocking = BLK_ON;
- (*fp)->flags = APR_READ | APR_WRITE | APR_EXCL | APR_DELONCLOSE;
fd = mkstemp(template);
if (fd == -1) {
return errno;
}
+ apr_os_file_put(fp, &fd, flags, p);
(*fp)->fname = apr_pstrdup(p, template);
- (*fp)->filedes = fd;
apr_pool_cleanup_register((*fp)->cntxt, (void *)(*fp),
apr_unix_file_cleanup, apr_unix_file_cleanup);
1.90 +5 -4 apr/file_io/unix/open.c
Index: open.c
===================================================================
RCS file: /home/cvs/apr/file_io/unix/open.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- open.c 29 Dec 2001 06:55:24 -0000 1.89
+++ open.c 8 Jan 2002 06:26:09 -0000 1.90
@@ -211,7 +211,7 @@
APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file,
apr_os_file_t *thefile,
- apr_pool_t *cont)
+ apr_int32_t flags, apr_pool_t *cont)
{
int *dafile = thefile;
@@ -223,6 +223,7 @@
(*file)->timeout = -1;
(*file)->ungetchar = -1; /* no char avail */
(*file)->filedes = *dafile;
+ (*file)->flags = flags;
/* buffer already NULL;
* don't get a lock (only for buffered files)
*/
@@ -242,7 +243,7 @@
{
int fd = STDERR_FILENO;
- return apr_os_file_put(thefile, &fd, cont);
+ return apr_os_file_put(thefile, &fd, 0, cont);
}
APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile,
@@ -250,7 +251,7 @@
{
int fd = STDOUT_FILENO;
- return apr_os_file_put(thefile, &fd, cont);
+ return apr_os_file_put(thefile, &fd, 0, cont);
}
APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile,
@@ -258,7 +259,7 @@
{
int fd = STDIN_FILENO;
- return apr_os_file_put(thefile, &fd, cont);
+ return apr_os_file_put(thefile, &fd, 0, cont);
}
APR_IMPLEMENT_SET_INHERIT(file, flags, cntxt, apr_unix_file_cleanup)
1.88 +5 -3 apr/file_io/win32/open.c
Index: open.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/open.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- open.c 30 Dec 2001 22:25:49 -0000 1.87
+++ open.c 8 Jan 2002 06:26:09 -0000 1.88
@@ -415,12 +415,14 @@
APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file,
apr_os_file_t *thefile,
+ apr_int32_t flags,
apr_pool_t *cont)
{
(*file) = apr_pcalloc(cont, sizeof(apr_file_t));
(*file)->cntxt = cont;
(*file)->filehand = *thefile;
(*file)->ungetchar = -1; /* no char avail */
+ (*file)->flags;
return APR_SUCCESS;
}
@@ -440,7 +442,7 @@
if (file_handle == INVALID_HANDLE_VALUE)
return apr_get_os_error();
- return apr_os_file_put(thefile, &file_handle, cont);
+ return apr_os_file_put(thefile, &file_handle, 0, cont);
}
APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile, apr_pool_t *cont)
@@ -451,7 +453,7 @@
if (file_handle == INVALID_HANDLE_VALUE)
return apr_get_os_error();
- return apr_os_file_put(thefile, &file_handle, cont);
+ return apr_os_file_put(thefile, &file_handle, 0, cont);
}
APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, apr_pool_t *cont)
@@ -462,7 +464,7 @@
if (file_handle == INVALID_HANDLE_VALUE)
return apr_get_os_error();
- return apr_os_file_put(thefile, &file_handle, cont);
+ return apr_os_file_put(thefile, &file_handle, 0, cont);
}
APR_POOL_IMPLEMENT_ACCESSOR_X(file, cntxt);
1.112 +4 -1 apr/include/apr_file_io.h
Index: apr_file_io.h
===================================================================
RCS file: /home/cvs/apr/include/apr_file_io.h,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -r1.111 -r1.112
--- apr_file_io.h 27 Sep 2001 16:44:13 -0000 1.111
+++ apr_file_io.h 8 Jan 2002 06:26:09 -0000 1.112
@@ -579,6 +579,9 @@
* Open a temporary file
* @param fp The apr file to use as a temporary file.
* @param template The template to use when creating a temp file.
+ * @param flags The flags to open the file with. If this is zero,
+ * the file is opened with
+ * APR_READ | APR_WRITE | APR_EXCL | APR_DELONCLOSE
* @param p The pool to allocate the file out of.
* @ingroup apr_file_open
* @remark
@@ -590,7 +593,7 @@
*
*/
APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *tmplt,
- apr_pool_t *p);
+ apr_int32_t flags, apr_pool_t *p);
#ifdef __cplusplus
}
1.72 +2 -1 apr/include/apr_portable.h
Index: apr_portable.h
===================================================================
RCS file: /home/cvs/apr/include/apr_portable.h,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- apr_portable.h 19 Oct 2001 23:25:28 -0000 1.71
+++ apr_portable.h 8 Jan 2002 06:26:09 -0000 1.72
@@ -340,13 +340,14 @@
* convert the file from os specific type to apr type.
* @param file The apr file we are converting to.
* @param thefile The os specific file to convert
+ * @param flags The flags that were used to open this file.
* @param cont The pool to use if it is needed.
* @remark On Unix, it is only possible to put a file descriptor into
* an apr file type.
*/
APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file,
apr_os_file_t *thefile,
- apr_pool_t *cont);
+ apr_int32_t flags, apr_pool_t *cont);
/**
* convert the dir from os specific type to apr type.
1.65 +1 -1 apr/locks/unix/locks.c
Index: locks.c
===================================================================
RCS file: /home/cvs/apr/locks/unix/locks.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- locks.c 29 Dec 2001 23:14:22 -0000 1.64
+++ locks.c 8 Jan 2002 06:26:09 -0000 1.65
@@ -388,7 +388,7 @@
(*lock)->pool = pool;
}
#if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
- apr_os_file_put(&(*lock)->interproc, &thelock->crossproc, pool);
+ apr_os_file_put(&(*lock)->interproc, &thelock->crossproc, 0, pool);
#endif
#if APR_HAS_PROC_PTHREAD_SERIALIZE
(*lock)->pthread_interproc = thelock->pthread_interproc;
1.10 +1 -1 apr/locks/unix/proc_mutex.c
Index: proc_mutex.c
===================================================================
RCS file: /home/cvs/apr/locks/unix/proc_mutex.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- proc_mutex.c 29 Dec 2001 23:14:22 -0000 1.9
+++ proc_mutex.c 8 Jan 2002 06:26:09 -0000 1.10
@@ -827,7 +827,7 @@
(*pmutex)->pool = pool;
}
#if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE
- apr_os_file_put(&(*pmutex)->interproc, &ospmutex->crossproc, pool);
+ apr_os_file_put(&(*pmutex)->interproc, &ospmutex->crossproc, 0, pool);
#endif
#if APR_HAS_PROC_PTHREAD_SERIALIZE
(*pmutex)->pthread_interproc = ospmutex->pthread_interproc;
1.37 +1 -1 apr/shmem/unix/shmem.c
Index: shmem.c
===================================================================
RCS file: /home/cvs/apr/shmem/unix/shmem.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- shmem.c 5 Jan 2002 13:38:44 -0000 1.36
+++ shmem.c 8 Jan 2002 06:26:09 -0000 1.37
@@ -153,7 +153,7 @@
if (tmpfd == -1)
return errno;
- apr_os_file_put(&new_m->file, &tmpfd, pool);
+ apr_os_file_put(&new_m->file, &tmpfd, O_READ | O_WRITE | O_CREATE, pool);
status = apr_file_trunc(new_m->file, reqsize);
if (status != APR_SUCCESS)
{
1.28 +1 -1 httpd-2.0/support/htdigest.c
Index: htdigest.c
===================================================================
RCS file: /home/cvs/httpd-2.0/support/htdigest.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- htdigest.c 1 Oct 2001 19:19:45 -0000 1.27
+++ htdigest.c 8 Jan 2002 06:26:10 -0000 1.28
@@ -264,7 +264,7 @@
else if (argc != 4)
usage();
- if (apr_file_mktemp(&tfp, tn, cntxt) != APR_SUCCESS) {
+ if (apr_file_mktemp(&tfp, tn, 0, cntxt) != APR_SUCCESS) {
fprintf(stderr, "Could not open temp file.\n");
exit(1);
}