Index: trunk/src/sh_sub.c
===================================================================
--- trunk/src/sh_sub.c	(revision 324)
+++ trunk/src/sh_sub.c	(revision 325)
@@ -348,4 +348,8 @@
 }
 
+#ifndef ETIMEDOUT
+#define ETIMEDOUT EIO
+#endif
+
 static ssize_t sh_sub_read(int fd, void *buf, size_t count)
 {
@@ -371,8 +375,11 @@
 	else
 	  {
+	    if (rcount >= 0) 
+	      errno = ETIMEDOUT;
 	    return -1;
 	  }
       }
-  } while (count > 0 && (errno == EAGAIN || errno == EWOULDBLOCK));
+  } while (count > 0 && 
+	   (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR));
 
   if (count > 0)
@@ -471,8 +478,4 @@
   } while (retval < 0 && errno == EINTR);
 
-#ifndef ETIMEDOUT
-#define ETIMEDOUT EIO
-#endif
-
   if (retval <= 0)
     {
