X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fpty.c;h=52a426c0e15fd8314571570bcb94f8291cc3ae85;hb=e9e310f8e99c63c764f71ed0c224ccd3cceb90c7;hp=31123e5af20636e71476ae52043327af5e99ba5b;hpb=fb1f4170d008315cb9eabe994038977a0366ede5;p=elogind.git diff --git a/src/shared/pty.c b/src/shared/pty.c index 31123e5af..52a426c0e 100644 --- a/src/shared/pty.c +++ b/src/shared/pty.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include @@ -68,7 +67,7 @@ #include "ring.h" #include "util.h" -#define PTY_BUFSIZE 16384 +#define PTY_BUFSIZE 4096 enum { PTY_ROLE_UNKNOWN, @@ -306,11 +305,11 @@ static int pty_dispatch_read(Pty *pty) { /* * We're edge-triggered, means we need to read the whole queue. This, * however, might cause us to stall if the writer is faster than we - * are. Therefore, we read twice and if the second read still returned - * data, we reschedule. + * are. Therefore, try reading as much as 8 times (32KiB) and only + * bail out then. */ - for (i = 0; i < 2; ++i) { + for (i = 0; i < 8; ++i) { len = read(pty->fd, pty->in_buf, sizeof(pty->in_buf) - 1); if (len < 0) { if (errno == EINTR)