summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2006-08-07 20:12:18 +0000
committerphk <phk@FreeBSD.org>2006-08-07 20:12:18 +0000
commit1c0399f7981f6976690ab2114fcf6915ac0c724c (patch)
tree849f4dfb7159c505882724fdd6527fb04589a6af /lib
parent1022710a4334295b43213bdf07d57fc95575935f (diff)
downloadFreeBSD-src-1c0399f7981f6976690ab2114fcf6915ac0c724c.zip
FreeBSD-src-1c0399f7981f6976690ab2114fcf6915ac0c724c.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/syslog.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c
index e58e695..dfb117e 100644
--- a/lib/libc/gen/syslog.c
+++ b/lib/libc/gen/syslog.c
@@ -116,7 +116,7 @@ writehook(void *cookie, const char *buf, int len)
h->base += len;
h->left -= len;
}
- return 0;
+ return len;
}
/*
OpenPOWER on IntegriCloud