htcacheclean may remove directories underneath us. * So, we'll try renaming three times at a cost of 0.002 seconds. */
| 133 | * So, we'll try renaming three times at a cost of 0.002 seconds. |
| 134 | */ |
| 135 | static 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 | |
| 161 | static apr_status_t file_cache_el_final(disk_cache_conf *conf, disk_cache_file_t *file, |
| 162 | request_rec *r) |
no test coverage detected