Hi Takeru,
Takeru Fukushima wrote,
Hi,
Unable to output messages in syslog function immediately after restarting the log
daemon.
Caused by ECONNREFUSED on errno in the following __vsyslog function.
(libc/misc/syslog/syslog.c)
I am unable to reproduce it with following test case and busybox
syslogd. What kind of syslogd do you are using?
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <time.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <sys/file.h>
#include <sys/signal.h>
#include <sys/syslog.h>
int main(void)
{
char tbuf[1024];
char strbuf[1024];
time_t now;
int rc, count = 0;
printf("\nSyslog loop start!\n\n");
openlog("test", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1);
while (fgets(strbuf, 1024, stdin)) {
if ((char)'e' == strbuf[0]) {
printf("Syslog loop end\n");
break;
}
syslog(LOG_USER|LOG_NOTICE, "Test %u", count++);
}
closelog();
return 0;
}