Index: src/launch.c
===================================================================
--- xqf/src/launch.c	(revision 814)
+++ xqf/src/launch.c	(revision 815)
@@ -168,12 +168,15 @@
 
   res = read (fd, cl->buffer + cl->pos, CLIENT_ERROR_BUFFER - 1 - cl->pos);
 
-  if (res <= 0) {	/* read error or EOF */
+  if (res < 0) {	/* read error or EOF */
     if (errno == EAGAIN || errno == EWOULDBLOCK)
       return;
 
     client_detach (cl);
     return;
+  } else if (res == 0) {
+    client_detach (cl);
+    return;
   }
 
   if (cl->pos + res == CLIENT_ERROR_BUFFER - 1) {
