Index: trunk/src/sh_unix.c
===================================================================
--- trunk/src/sh_unix.c	(revision 87)
+++ trunk/src/sh_unix.c	(revision 89)
@@ -4323,5 +4323,6 @@
 
 
-int hideout_hex_block(SL_TICKET fd, unsigned char * str, int len);
+int hideout_hex_block(SL_TICKET fd, unsigned char * str, int len,
+		      unsigned long * bytes_read);
 unsigned long first_hex_block(SL_TICKET fd, unsigned long * max);
 
@@ -4331,7 +4332,8 @@
 int sh_unix_getline_stealth (SL_TICKET fd, char * str, int len)
 {
-  int                  add_off, llen;
-  static unsigned long off_data = 0;
-  static unsigned long max_data = 0;
+  int                  add_off = 0, llen;
+  static unsigned long off_data   = 0;
+  static unsigned long max_data   = 0;
+  static unsigned long bytes_read = 0;
   static int           stealth_init = BAD;
 
@@ -4358,5 +4360,5 @@
   /* --- Seek to proper position. ---
    */
-  if (off_data >= max_data)
+  if (bytes_read >= max_data || add_off < 0)
     {
       dlog(1, FIL__, __LINE__, 
@@ -4370,5 +4372,5 @@
   /* --- Read one line. ---
    */
-  add_off   = hideout_hex_block(fd, (unsigned char *) str, len);
+  add_off   = hideout_hex_block(fd, (unsigned char *) str, len, &bytes_read);
   off_data += add_off;
 
@@ -4377,5 +4379,6 @@
 }
 
-int hideout_hex_block(SL_TICKET fd, unsigned char * str, int len)
+int hideout_hex_block(SL_TICKET fd, unsigned char * str, int len, 
+		      unsigned long * bytes_read)
 {
 
@@ -4386,4 +4389,5 @@
   unsigned long here   = 0;
   unsigned long retval = 0;
+  unsigned long bread  = 0;
 
   SL_ENTER(_("hideout_hex_block"));
@@ -4410,7 +4414,10 @@
 		  num = sl_read (fd, &c, 1);
 		} while (num == 0 && errno == EINTR);
-		if (num == 0) 
+		if (num > 0)
+		  ++here;
+		else if (num == 0)
 		  SL_RETURN((0), _("hideout_hex_block"));
-		++here; 
+		else 
+		  SL_RETURN((-1), _("hideout_hex_block"));
 	      } while (c == '\n' || c == '\t' || c == '\r' || 
 		       c == ' ');
@@ -4426,4 +4433,5 @@
 	    str[i] &= ~mask[j];
 
+	  bread += 1;
 	}
       if (str[i] == '\n') break;
@@ -4436,4 +4444,5 @@
     str[i+1] = '\0'; /* keep newline and terminate */
   retval += here;
+  *bytes_read += (bread/8);
 
   SL_RETURN(retval, _("hideout_hex_block"));
