]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
If log write() fails because of EINTR, try again 2 more times.
authorTimo Sirainen <tss@iki.fi>
Wed, 18 Mar 2009 17:47:58 +0000 (13:47 -0400)
committerTimo Sirainen <tss@iki.fi>
Wed, 18 Mar 2009 17:47:58 +0000 (13:47 -0400)
--HG--
branch : HEAD

src/lib/failures.c

index a4de26c7951e65a9b4315e3e0994c6a22f929cfb..776bbdfc952452e1b9b8fcf6bc02afc1dc1953ff 100644 (file)
@@ -82,6 +82,7 @@ static int log_fd_write(int fd, const unsigned char *data, unsigned int len)
        struct ioloop *ioloop;
        struct io *io;
        ssize_t ret;
+       unsigned int eintr_count = 0;
 
        while ((ret = write(fd, data, len)) != (ssize_t)len) {
                if (ret > 0) {
@@ -95,6 +96,11 @@ static int log_fd_write(int fd, const unsigned char *data, unsigned int len)
                        errno = ENOSPC;
                        return -1;
                }
+               if (errno == EINTR && ++eintr_count < 3) {
+                       /* we don't want to die because of this.
+                          try again a couple of times. */
+                       continue;
+               }
                if (errno != EAGAIN)
                        return -1;