mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Log why writing to audit log failed
Add error description from apr_strerror() to message that is logged if writing to audit log failed.
This commit is contained in:
committed by
Felipe Zimmerle
parent
607dfd229a
commit
7e459827e0
@@ -49,10 +49,13 @@ static int sec_auditlog_write(modsec_rec *msr, const char *data, unsigned int le
|
|||||||
/* Write data to file. */
|
/* Write data to file. */
|
||||||
rc = apr_file_write_full(msr->new_auditlog_fd, data, nbytes, &nbytes_written);
|
rc = apr_file_write_full(msr->new_auditlog_fd, data, nbytes, &nbytes_written);
|
||||||
if (rc != APR_SUCCESS) {
|
if (rc != APR_SUCCESS) {
|
||||||
msr_log(msr, 1, "Audit log: Failed writing (requested %" APR_SIZE_T_FMT
|
char errstr[1024];
|
||||||
" bytes, written %" APR_SIZE_T_FMT ")", nbytes, nbytes_written);
|
|
||||||
|
|
||||||
/* Concurrent log format: Don't leak file handle. */
|
msr_log(msr, 1, "Audit log: Failed writing (requested %" APR_SIZE_T_FMT
|
||||||
|
" bytes, written %" APR_SIZE_T_FMT "): %s", nbytes, nbytes_written,
|
||||||
|
apr_strerror(rc, errstr, sizeof(errstr));
|
||||||
|
|
||||||
|
/* Concurrent log format: don't leak file handle. */
|
||||||
if (msr->txcfg->auditlog_type == AUDITLOG_CONCURRENT) {
|
if (msr->txcfg->auditlog_type == AUDITLOG_CONCURRENT) {
|
||||||
apr_file_close(msr->new_auditlog_fd);
|
apr_file_close(msr->new_auditlog_fd);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user