if (!vstr_add_cstr_ptr(dlg, 0, vlg->tm_data) ||
if (!vstr_add_cstr_ptr(dlg, 0, tm_data) ||
static void vlg__flush(Vlg *vlg, int type, int out_err){  Vstr_base *dlg = vlg->out_vstr;  time_t now = (*vlg->tm_get)();    ASSERT(vstr_export_chr(dlg, dlg->len) == '\n');  if (now != vlg->tm_time)  {    vlg->tm_time = now;    date_syslog(vlg->tm_time, vlg->tm_data, sizeof(vlg->tm_data));  }    if (vlg->daemon_mode)  {    if (!vlg__syslog_con(vlg, 0))    { /* ignoring borken syslog()'s that overflow here use a real OS */      const char *tmp = vstr_export_cstr_ptr(dlg, 1, dlg->len - 1);            if (!tmp)        errno = ENOMEM, err(EXIT_FAILURE, "vlog__flush");            syslog(type, "%s", tmp);    }    else    {      pid_t pid = getpid();      int fd = vlg->syslog_fd;      size_t beg_len = 0;      vstr_add_fmt(dlg, 0, "<%u>%s %s[%lu]: ", type | LOG_DAEMON,                   vlg->tm_data, vlg->prog_name, (unsigned long)pid);            if (vlg->syslog_stream)        vstr_sub_buf(dlg, dlg->len, 1, "", 1);      else        vstr_sc_reduce(dlg, 1, dlg->len, 1); /* remove "\n" */            if (dlg->conf->malloc_bad)        errno = ENOMEM, err(EXIT_FAILURE, "vlog__flush");      beg_len = dlg->len;      while (dlg->len)        if (!vstr_sc_write_fd(dlg, 1, dlg->len, fd, NULL) && (errno != EAGAIN))        {          vlg__syslog_close(vlg);          if (beg_len != dlg->len) /* we have sent _some_ data, and it died */            break;          if (!vlg__syslog_con(vlg, 0))            err(EXIT_FAILURE, "vlg__syslog_con");        }    }        vstr_del(dlg, 1, dlg->len);  }  else  {    int fd = out_err ? STDERR_FILENO : STDOUT_FILENO;        if (vlg->log_prefix_console)    {      /* Note: we add the begining backwards, it's easier that way */      if ((type == LOG_WARNING) && !vstr_add_cstr_ptr(dlg, 0, "WARN: "))        errno = ENOMEM, err(EXIT_FAILURE, "warn");      if ((type == LOG_ALERT) && !vstr_add_cstr_ptr(dlg, 0, "ERR: "))        errno = ENOMEM, err(EXIT_FAILURE, "err");      if ((type == LOG_DEBUG) && !vstr_add_cstr_ptr(dlg, 0, "DEBUG: "))        errno = ENOMEM, err(EXIT_FAILURE, "vlog_vdbg");            if (!vlg->log_pid)      {        if (!vstr_add_cstr_ptr(dlg, 0, "]: "))          errno = ENOMEM, err(EXIT_FAILURE, "prefix");      }      else      {        pid_t pid = getpid();                if (!vstr_add_fmt(dlg, 0, "] %lu: ", (unsigned long)pid))          errno = ENOMEM, err(EXIT_FAILURE, "prefix");      }            if (!vstr_add_cstr_ptr(dlg, 0, vlg->tm_data) ||          !vstr_add_cstr_ptr(dlg, 0, "["))        errno = ENOMEM, err(EXIT_FAILURE, "prefix");          }        while (dlg->len)      if (!vstr_sc_write_fd(dlg, 1, dlg->len, fd, NULL) && (errno != EAGAIN))        err(EXIT_FAILURE, "vlg__flush");  }}