Re: [RELEASE CANDIDATE] libapreq2 2.08-RC4

Randy Kobes <[email protected]>
Newsgroups gmane.comp.apache.apreq
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.