MCPcopy Index your code
hub / github.com/apache/httpd / safe_file_rename

Function safe_file_rename

modules/cache/mod_cache_disk.c:135–159  ·  view source on GitHub ↗

htcacheclean may remove directories underneath us. * So, we'll try renaming three times at a cost of 0.002 seconds. */

Source from the content-addressed store, hash-verified

133 * So, we'll try renaming three times at a cost of 0.002 seconds.
134 */
135static apr_status_t safe_file_rename(disk_cache_conf *conf,
136 const char *src, const char *dest,
137 apr_pool_t *pool)
138{
139 apr_status_t rv;
140
141 rv = apr_file_rename(src, dest, pool);
142
143 if (rv != APR_SUCCESS) {
144 int i;
145
146 for (i = 0; i < 2 && rv != APR_SUCCESS; i++) {
147 /* 1000 micro-seconds aka 0.001 seconds. */
148 apr_sleep(1000);
149
150 rv = mkdir_structure(conf, dest, pool);
151 if (rv != APR_SUCCESS)
152 continue;
153
154 rv = apr_file_rename(src, dest, pool);
155 }
156 }
157
158 return rv;
159}
160
161static apr_status_t file_cache_el_final(disk_cache_conf *conf, disk_cache_file_t *file,
162 request_rec *r)

Callers 1

file_cache_el_finalFunction · 0.85

Calls 1

mkdir_structureFunction · 0.85

Tested by

no test coverage detected