*/
#include "libbb.h"
#include "shell_common.h"
+#include <sys/resource.h> /* getrlimit */
const char defifsvar[] ALIGN1 = "IFS= \t\n";
old_tty = tty;
if (nchars) {
tty.c_lflag &= ~ICANON;
- tty.c_cc[VMIN] = nchars < 256 ? nchars : 255;
+ // Setting it to more than 1 breaks poll():
+ // it blocks even if there's data. !??
+ //tty.c_cc[VMIN] = nchars < 256 ? nchars : 255;
+ /* reads would block only if < 1 char is available */
+ tty.c_cc[VMIN] = 1;
+ /* no timeout (reads block forever) */
+ tty.c_cc[VTIME] = 0;
}
if (read_flags & BUILTIN_READ_SILENT) {
tty.c_lflag &= ~(ECHO | ECHOK | ECHONL);
int timeout;
if ((bufpos & 0xff) == 0)
- buffer = xrealloc(buffer, bufpos + 0x100);
+ buffer = xrealloc(buffer, bufpos + 0x101);
timeout = -1;
if (end_ms) {