On 3/11/07, Randy Kobes <[EMAIL PROTECTED]> wrote:
On Fri, 9 Mar 2007, Joe Schaefer wrote:

> Randy, do you know why we use the APR_FILE_NOCLEANUP flag?  Maybe
> we should just remove that and see if it fixes the problem Vinay
> is seeing.

Hi Steve, and all,
 If you remember from
   http://marc.theaimsgroup.com/?t=115337629400001&r=1&w=2
there was a problem with stray temp files in apreq
remaining after uploads; we came up with a fix that
worked most of the time, but Vinay has come up with
something that appears better, and more understandable.
The attached diff against library/util.c (in the svn
sources) works for me in getting multiple invocations
of the glue/perl/t/apreq/upload.t to pass; if you have
time, could you try it out to see how it fares on
your system? Thanks.

Actually, either my earlier patch which adds a apr_file_close in
apreq_file_cleanup or just removing the APR_FILE_NOCLEANUP from the
flags(patch attached) is enough. Both together isn't required. (but
it's safe as the cleanup handler installed by apr would get
uninstalled when you do apr_file_close). I favor doing just one of
them, preferably, removing the APR_FILE_NOCLEANUP flag. This makes the
WIN32 code identical to other platforms(where it's already working
fine, so no change for them). Patch for the same against the svn
source is given below. Please try this on win32 systems.


Thanks,
Vinay Y S


Index: library/util.c

===================================================================

--- library/util.c      (revision 516861)

+++ library/util.c      (working copy)

@@ -823,14 +823,6 @@


    /* NO APR_DELONCLOSE! see comment above */
    flag = APR_CREATE | APR_READ | APR_WRITE | APR_EXCL | APR_BINARY;
-    /* Win32 needs the following to remove temp files.
-     * XXX: figure out why the APR_SHARELOCK flag works;
-     * a grep through the httpd sources seems to indicate
-     * it's only used in sdbm files??
-    */
-#ifdef WIN32
-    flag |= APR_FILE_NOCLEANUP | APR_SHARELOCK;
-#endif
    rc = apr_file_mktemp(fp, tmpl, flag, pool);

    if (rc == APR_SUCCESS) {
Index: library/util.c
===================================================================
--- library/util.c      (revision 516861)
+++ library/util.c      (working copy)
@@ -823,14 +823,6 @@
 
     /* NO APR_DELONCLOSE! see comment above */
     flag = APR_CREATE | APR_READ | APR_WRITE | APR_EXCL | APR_BINARY;
-    /* Win32 needs the following to remove temp files.
-     * XXX: figure out why the APR_SHARELOCK flag works;
-     * a grep through the httpd sources seems to indicate
-     * it's only used in sdbm files??
-    */
-#ifdef WIN32
-    flag |= APR_FILE_NOCLEANUP | APR_SHARELOCK;
-#endif
     rc = apr_file_mktemp(fp, tmpl, flag, pool);
 
     if (rc == APR_SUCCESS) {

Reply via email to