--- erts/emulator/beam/io.c~    2007-03-27 15:27:11.000000000 +0200
+++ erts/emulator/beam/io.c     2007-06-02 18:17:46.000000000 +0200
@@ -3863,8 +3863,10 @@
 {
     ErlIOQueue* q = drvport2ioq(ix);
 
-    if (q == NULL)
+    if (q == NULL) {
+       *vlenp = 0;
        return NULL;
+    }
     if ((*vlenp = (q->v_tail - q->v_head)) == 0)
        return NULL;
     return q->v_head;

