- __openlog(ident, opt, facility);
+
+ if (ident) {
+ size_t n = strnlen(ident, sizeof log_ident - 1);
+ memcpy(log_ident, ident, n);
+ log_ident[n] = 0;
+ } else {
+ log_ident[0] = 0;
+ }
+ log_opt = opt;
+ log_facility = facility;
+
+ if ((opt & LOG_NDELAY) && log_fd<0) __openlog();
+
now = time(NULL);
gmtime_r(&now, &tm);
strftime(timebuf, sizeof timebuf, "%b %e %T", &tm);
pid = (log_opt & LOG_PID) ? getpid() : 0;
l = snprintf(buf, sizeof buf, "<%d>%s %s%s%.0d%s: ",
now = time(NULL);
gmtime_r(&now, &tm);
strftime(timebuf, sizeof timebuf, "%b %e %T", &tm);
pid = (log_opt & LOG_PID) ? getpid() : 0;
l = snprintf(buf, sizeof buf, "<%d>%s %s%s%.0d%s: ",
- priority, timebuf,
- log_ident ? log_ident : "",
- "["+!pid, pid, "]"+!pid);
+ priority, timebuf, log_ident, "["+!pid, pid, "]"+!pid);
l2 = vsnprintf(buf+l, sizeof buf - l, message, ap);
if (l2 >= 0) {
l2 = vsnprintf(buf+l, sizeof buf - l, message, ap);
if (l2 >= 0) {
- sendto(log_fd, buf, l, 0, (void *)&log_addr, 11);
+ send(log_fd, buf, l, 0);