diff options
author | Michael Adam <obnox@samba.org> | 2013-11-09 13:25:03 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2013-11-09 13:34:33 +0100 |
commit | 4bbd6e8626475222b0aa37dde62d12d77667accb (patch) | |
tree | 2b9d5b257e4cd0b6df3bce23d044eef027e60f8f | |
parent | d652681e8a53a767843ab55a3636d77e183e53f9 (diff) | |
download | tinyproxy-4bbd6e8626475222b0aa37dde62d12d77667accb.tar.gz tinyproxy-4bbd6e8626475222b0aa37dde62d12d77667accb.zip |
[BB#109] Fix crash (infinite loop) when writing to log file fails.
Fall back to syslog logging in that case.
Signed-off-by: Michael Adam <obnox@samba.org>
Diffstat (limited to '')
-rw-r--r-- | src/log.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -188,8 +188,13 @@ void log_message (int level, const char *fmt, ...) ret = write (log_file_fd, str, strlen (str)); if (ret == -1) { - log_message (LOG_WARNING, - "Could not write to log file"); + config.syslog = TRUE; + + log_message(LOG_CRIT, "ERROR: Could not write to log " + "file %s: %s.", + config.logf_name, strerror(errno)); + log_message(LOG_CRIT, + "Falling back to syslog logging"); } fsync (log_file_fd); |