Return length from fwopen() file callback instead of zero.
The symptom is that syslog() fails to log anything but the "ident" string if LOG_PERROR is specified to openlog(3) and the extensible printf is in action. For unclear, likely quaint historical reasons, syslog uses fwopen() on a stack buffer, rather than using the more straightforward and faster snprintf(). Along the way, fflush(3) is called, and since the callback writer function returns zero instead of the length "written", __SERR naturally gets set on the filedescriptor. The extensible printf, in difference from the normal printf refuses to output anything to an __SERR marked filedescriptor, and thus the actual syslog message is supressed. MFC: after 2 weeks
This commit is contained in:
parent
7fd26f86d1
commit
5b1deb3ce8
@ -116,7 +116,7 @@ writehook(void *cookie, const char *buf, int len)
|
||||
h->base += len;
|
||||
h->left -= len;
|
||||
}
|
||||
return 0;
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user