Index: trunk/src/sh_fInotify.c
===================================================================
--- trunk/src/sh_fInotify.c	(revision 565)
+++ trunk/src/sh_fInotify.c	(revision 568)
@@ -197,11 +197,11 @@
   /* Blocking read from inotify file descriptor.
    */
-  len = sh_inotify_read_timeout(buffer, 16384, 1);
+  len = sh_inotify_read_timeout (buffer, 16384, 1);
   
   if (len > 0)
     {
       struct inotify_event *event;
-      int i = 0;
-      
+      long i = 0;
+
       while (i < len) 
 	{
Index: trunk/src/sh_inotify.c
===================================================================
--- trunk/src/sh_inotify.c	(revision 565)
+++ trunk/src/sh_inotify.c	(revision 568)
@@ -236,5 +236,5 @@
   int     ifd = sh_inotify_getfd();
 
-  len = sl_read_timeout_fd (ifd, buffer, count, timeout, S_FALSE);
+  len = sl_read_timeout_fd_once (ifd, buffer, count, timeout, S_FALSE);
 
   return len;
Index: trunk/src/slib.c
===================================================================
--- trunk/src/slib.c	(revision 565)
+++ trunk/src/slib.c	(revision 568)
@@ -2634,6 +2634,6 @@
 
 
-int sl_read_timeout_fd (int fd, void * buf_in, size_t count, 
-			int timeout, int is_nonblocking)
+static int sl_read_timeout_fd_int (int fd, void * buf_in, size_t count, 
+				   int timeout, int is_nonblocking, int once)
 {
   int sflags = 0;
@@ -2684,5 +2684,5 @@
 	      bytes += byteread; count -= byteread;
 	      buf += byteread;
-	      if (count == 0)
+	      if (count == 0 || once == S_TRUE)
 		break;
 	    }  
@@ -2768,4 +2768,16 @@
 }
 
+int sl_read_timeout_fd (int fd, void * buf_in, size_t count, 
+			int timeout, int is_nonblocking)
+{
+  return sl_read_timeout_fd_int (fd, buf_in, count, timeout, is_nonblocking, S_FALSE);
+}
+
+int sl_read_timeout_fd_once (int fd, void * buf_in, size_t count, 
+			int timeout, int is_nonblocking)
+{
+  return sl_read_timeout_fd_int (fd, buf_in, count, timeout, is_nonblocking, S_TRUE);
+}
+
 int sl_read_timeout (SL_TICKET ticket, void * buf_in, size_t count, 
 		     int timeout, int is_nonblocking)
