Hi
I would be inclined to leave these - they don't cost much and people
expect to see EINTR handled.
On Sun, Oct 05, 2014 at 09:55:39PM +0200, Alexander Bluhm wrote:
> Hi,
>
> As libevent uses sigaction(2) with SA_RESTART, the code to handle
> EINTR errors can be removed.
>
> ok?
>
> bluhm
>
> Index: usr.sbin/syslogd/syslogd.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/syslogd/syslogd.c,v
> retrieving revision 1.128
> diff -u -p -r1.128 syslogd.c
> --- usr.sbin/syslogd/syslogd.c 5 Oct 2014 18:14:01 -0000 1.128
> +++ usr.sbin/syslogd/syslogd.c 5 Oct 2014 19:34:53 -0000
> @@ -619,7 +619,7 @@ klog_readcb(int fd, short event, void *a
> if (n > 0) {
> linebuf[n] = '\0';
> printsys(linebuf);
> - } else if (n < 0 && errno != EINTR) {
> + } else if (n < 0) {
> logerror("klog");
> event_del(ev);
> }
> @@ -641,7 +641,7 @@ udp_readcb(int fd, short event, void *ar
> cvthname((struct sockaddr *)&sa, resolve, sizeof(resolve));
> dprintf("cvthname res: %s\n", resolve);
> printline(resolve, linebuf);
> - } else if (n < 0 && errno != EINTR)
> + } else if (n < 0)
> logerror("recvfrom udp");
> }
>
> @@ -657,7 +657,7 @@ unix_readcb(int fd, short event, void *a
> if (n > 0) {
> linebuf[n] = '\0';
> printline(LocalHostName, linebuf);
> - } else if (n == -1 && errno != EINTR)
> + } else if (n < 0)
> logerror("recvfrom unix");
> }
>
> @@ -1914,8 +1914,7 @@ ctlsock_acceptcb(int fd, short event, vo
> dprintf("Accepting control connection\n");
> fd = accept(fd, NULL, NULL);
> if (fd == -1) {
> - if (errno != EINTR && errno != EWOULDBLOCK &&
> - errno != ECONNABORTED)
> + if (errno != EWOULDBLOCK && errno != ECONNABORTED)
> logerror("accept ctlsock");
> return;
> }
> @@ -1972,13 +1971,10 @@ ctlconn_readcb(int fd, short event, void
> return;
> }
>
> - retry:
> n = read(fd, (char*)&ctl_cmd + ctl_cmd_bytes,
> sizeof(ctl_cmd) - ctl_cmd_bytes);
> switch (n) {
> case -1:
> - if (errno == EINTR)
> - goto retry;
> logerror("ctlconn read");
> /* FALLTHROUGH */
> case 0:
> @@ -2101,13 +2097,10 @@ ctlconn_writecb(int fd, short event, voi
> return;
> }
>
> - retry:
> n = write(fd, ctl_reply + ctl_reply_offset,
> ctl_reply_size - ctl_reply_offset);
> switch (n) {
> case -1:
> - if (errno == EINTR)
> - goto retry;
> if (errno != EPIPE)
> logerror("ctlconn write");
> /* FALLTHROUGH */
>