[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>
(cherry picked from commit 4bbd6e8626)
			
			
This commit is contained in:
		
							parent
							
								
									54eaac8e76
								
							
						
					
					
						commit
						0adf359245
					
				@ -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);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user