Don't unnecessarily rename request body parts in cleanup

When tmp_dir and upload_dir are identical, there's no reason to
rename multipart and request body parts, as this is a non-op. Let's
save the cycles and syscall.
This commit is contained in:
Robert Paprocki
2016-10-04 15:45:25 -07:00
committed by Felipe Zimmerle
parent 8559dd3b8b
commit 709042a472
2 changed files with 12 additions and 0 deletions

View File

@@ -1327,6 +1327,11 @@ apr_status_t multipart_cleanup(modsec_rec *msr) {
} else {
/* Move file to the upload dir. */
if (parts[i]->tmp_file_name != NULL) {
if (strcmp(msr->txcfg->upload_dir, msr->txcfg->tmp_dir) == 0) {
msr_log(msr, 4, "Not moving part to identical location");
continue;
}
const char *new_filename = NULL;
const char *new_basename = NULL;