httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject Re: [RELEASE CANDIDATE] libapreq2 2.08-RC4
Date Tue, 25 Jul 2006 04:11:05 GMT
On Mon, 24 Jul 2006, Steve Hay wrote:

> Randy Kobes wrote:
>
>> Also, just to verify that it is the stray temp files
>> left over that are causing the problem, does it help
>> if you change the APR_EXCL flag in the 
>> call to apr_file_mktemp on about line 832 of library/util.c
>> to APR_TRUNCATE?
> Yep, that makes the errors go away: it didn't fail once in about two dozen 
> runs.

Does the following help?

=====================================================
Index: util.c
===================================================================
--- util.c	(revision 425268)
+++ util.c	(working copy)
@@ -811,6 +811,7 @@
      apr_status_t rc;
      char *tmpl;
      struct cleanup_data *data;
+    apr_int32_t flag;

      if (path == NULL) {
          rc = apr_temp_dir_get(&path, pool);
@@ -829,9 +830,13 @@
      apr_pool_cleanup_register(pool, data,
                                apreq_file_cleanup, 
apreq_file_cleanup);

-    rc = apr_file_mktemp(fp, tmpl, /* NO APR_DELONCLOSE! 
see comment above */
-                           APR_CREATE | APR_READ | 
APR_WRITE
-                           | APR_EXCL | APR_BINARY, pool);
+    /* 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 */
+#ifdef WIN32
+    flag |= APR_FILE_NOCLEANUP | APR_SHARELOCK;
+#endif
+    rc = apr_file_mktemp(fp, tmpl, flag, pool);

      if (rc == APR_SUCCESS) {
          apr_file_name_get(&data->fname, *fp);

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

With the APR_SHARELOCK flag, I don't see any temp files
left over after about 50 runs of the upload.t test (without
it, but still with APR_FILE_NOCLEANUP, I would have 2-3
left over after 50 runs).

-- 
best regards,
Randy

Mime
View raw message