[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix to use the saved errno in scheduler/transport.c



We've had a long standing problem of the scheduler aborting very
occasionally. I went and stared at the relevant code earlier today and
it looks like it might be the classic errno getting overwritten by a
later syscall problem. What's stranger is the code has all the
machinery to avoid the problem, it just doesn't actually use the saved
value!

I see the problem so infrequently I can't really test it, but I'm
hoping this fixes it.

--
Alex Kiernan
Index: scheduler/transport.c
===================================================================
RCS file: /cvsroot/upstream/zmailer/scheduler/transport.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 transport.c
--- scheduler/transport.c	6 Jul 2004 16:28:04 -0000	1.1.1.3
+++ scheduler/transport.c	18 Oct 2005 09:01:16 -0000
@@ -1174,9 +1174,9 @@
 
 	  /* sfprintf(sfstderr, "got an interrupt (%d)\n", errno); */
 	  in_select = 0;
-	  if (errno == EINTR || errno == EAGAIN)
+	  if (err == EINTR || err == EAGAIN)
 	    return 0;
-	  if (errno == EINVAL || errno == EBADF) {
+	  if (err == EINVAL || err == EBADF) {
 	    sfprintf(sfstderr, "** select() returned errno=%d\n", err);
 	    for (i = 0; i < maxf; ++i) {
 	      if (_Z_FD_ISSET(i,rdmask)  &&  fcntl(i,F_GETFL,0) < 0)