Browse Source

syslog: fix 'everyone logs with user facility'

It's been found that on uclibc-based system most of the programs log with
'user' facility despite the calls to openlog() with other facilities explicitly
set. Most but not all. Investigating that I've found that the ones logging with
proper facilities used LOG_NDELAY in openlog(). The problem is that LogFacility
is overwritten in openlog_intern and LOG_USER is passed to it from vsyslog() no
matter what the program set with openlog().

Signed-off-by: Roman I Khimov <khimov@altell.ru>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Roman I Khimov 13 năm trước cách đây
mục cha
commit
8fdc17c2ba
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      libc/misc/syslog/syslog.c

+ 1 - 1
libc/misc/syslog/syslog.c

@@ -205,7 +205,7 @@ vsyslog(int pri, const char *fmt, va_list ap)
 	if ((LogMask & LOG_MASK(LOG_PRI(pri))) == 0)
 	if ((LogMask & LOG_MASK(LOG_PRI(pri))) == 0)
 		goto getout;
 		goto getout;
 	if (LogFile < 0 || !connected)
 	if (LogFile < 0 || !connected)
-		openlog_intern(NULL, LogStat | LOG_NDELAY, LOG_USER);
+		openlog_intern(NULL, LogStat | LOG_NDELAY, (int)LogFacility << 3);
 
 
 	/* Set default facility if none specified. */
 	/* Set default facility if none specified. */
 	if ((pri & LOG_FACMASK) == 0)
 	if ((pri & LOG_FACMASK) == 0)