+ goto err;
+ if (ret == 0)
+ return 0;
+ sz = btr_pool_get_buffer(sit->btrp, &buf);
+ if (sz == 0)
+ return 0;
+ if (sit->must_set_nonblock_flag) {
+ ret = mark_fd_nonblocking(STDIN_FILENO);
+ if (ret < 0)
+ goto err;
+ sit->must_set_nonblock_flag = false;
+ }
+ /*
+ * Do not use the maximal size to avoid having only a single buffer
+ * reference for the whole pool. This is bad because if that single
+ * reference can not be freed, we're stuck.
+ */
+ sz = PARA_MIN(sz, btr_pool_size(sit->btrp) / 2);
+ ret = read_nonblock(STDIN_FILENO, buf, sz, &s->rfds, &n);
+ if (n > 0)
+ btr_add_output_pool(sit->btrp, n, sit->btrn);
+ if (ret >= 0)
+ return 0;
+err:
+ btr_remove_node(&sit->btrn);
+ /* Revert to blocking mode if necessary. */
+ fcntl(STDIN_FILENO, F_SETFL, sit->fd_flags);
+ //btr_pool_free(sit->btrp);
+ return ret;