diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-08-21 15:15:38 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2018-08-21 15:15:38 +0000 |
| commit | dce2036b6addc24c675d8ec2cd5dd30293bb2b81 (patch) | |
| tree | 8a485e7b97aaf50223fbabe55bdfc4bd7b66e675 /lib/log.c | |
| parent | 5ab5e410d0ee14924e3a6d91336df176a4f06655 (diff) | |
lib: fix deadlock in log.c
Daemons could deadlock when log file could not be opened during a log
rotation.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/log.c')
| -rw-r--r-- | lib/log.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -868,11 +868,16 @@ int zlog_rotate(void) save_errno = errno; umask(oldumask); if (zl->fp == NULL) { + + pthread_mutex_unlock(&loglock); + flog_err_sys( LIB_ERR_SYSTEM_CALL, "Log rotate failed: cannot open file %s for append: %s", zl->filename, safe_strerror(save_errno)); ret = -1; + + pthread_mutex_lock(&loglock); } else { logfile_fd = fileno(zl->fp); zl->maxlvl[ZLOG_DEST_FILE] = level; |
