- buffer_consume(&q.data, eoq + strlen("\r\n\r\n") - q.data.data);
- if (xwrite(fd, "DUNNO\r\n", strlen("DUNNO\r\n"))) {
- UNIXERR("write");
- break;
- }
+static int policy_run(server_t *pcy, void* config)
+{
+ ssize_t search_offs = MAX(0, pcy->ibuf.len - 1);
+ int nb = buffer_read(&pcy->ibuf, pcy->fd, -1);
+ const char *eoq;
+
+ if (nb < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ return 0;
+ UNIXERR("read");
+ return -1;
+ }
+ if (nb == 0) {
+ if (pcy->ibuf.len)
+ syslog(LOG_ERR, "unexpected end of data");
+ return -1;