commit - 0696aea6cc2a797fd68090de35525de6b298e406
commit + ed005105533320c10c63f61686a3aee3b564904d
blob - 9e6511fc8dbeaf5b70d67ef9082bc18e6850f5dd
blob + e522c7d28e3357f5421e4b30c01507bb1c7b64ae
--- smtp_proc.c
+++ smtp_proc.c
buf.buf = reallocarray(buf.buf, buf.bufsize,
sizeof(*(buf.buf)));
if (buf.buf == NULL)
- fatalx(NULL);
+ fatal(NULL);
fmtlen = vsnprintf(buf.buf + buf.buflen,
buf.bufsize - buf.buflen, fmt, cap);
if (fmtlen == -1)
ssize_t wlen;
if (buf->buflen == 0)
- return;
- if (event_pending(&stdoutev, EV_WRITE, NULL))
return;
if (!evset) {
event_set(&stdoutev, fd, EV_WRITE, smtp_write, buf);
event_add(&stdoutev, NULL);
}
buf->buflen -= wlen;
+ if (buf->buflen == 0 && event_pending(&stdoutev, EV_WRITE, NULL))
+ event_del(&stdoutev);
}
void