diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-19 10:40:07 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1995-12-19 10:40:07 +0000 |
commit | d8d3fa7f696c03ecd58960ea9029ae9733fb9ced (patch) | |
tree | e30a573b3c643965d06897b532f0ba921b52e515 /gnu/usr.bin | |
parent | 95268d31ace2b168875b6ee4f0b8b8fb1305514c (diff) |
allow at most 256K of data to be queued
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r-- | gnu/usr.bin/cvs/src/server.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/gnu/usr.bin/cvs/src/server.c b/gnu/usr.bin/cvs/src/server.c index ebdefbb90d5..9053f6c5013 100644 --- a/gnu/usr.bin/cvs/src/server.c +++ b/gnu/usr.bin/cvs/src/server.c @@ -1094,6 +1094,7 @@ static void buf_output PROTO((struct buffer *, const char *, int)); static void buf_output0 PROTO((struct buffer *, const char *)); static inline void buf_append_char PROTO((struct buffer *, int)); static int buf_send_output PROTO((struct buffer *)); +static int buf_len PROTO((struct buffer *)); static int set_nonblock PROTO((struct buffer *)); static int set_block PROTO((struct buffer *)); static int buf_send_counted PROTO((struct buffer *)); @@ -1256,6 +1257,29 @@ buf_append_char (buf, ch) } /* + * Count how many bytes are in the buffer + */ + +static int +buf_len (buf) + struct buffer *buf; +{ + struct buffer_data *data; + int count = 0; + + if (! buf->output) + abort (); + + for (data = buf->data; data; data = data->next) + { + count += data->size; + } + + return (count); +} + + +/* * Send all the output we've been saving up. Returns 0 for success or * errno code. If the buffer has been set to be nonblocking, this * will just write until the write would block. @@ -2141,7 +2165,7 @@ do_cvs_command (command) FD_ZERO (&writefds); if (! buf_empty_p (&outbuf)) FD_SET (STDOUT_FILENO, &writefds); - if (stdout_pipe[0] >= 0) + if (stdout_pipe[0] >= 0 && buf_len (&outbuf) < 256*1024) { FD_SET (stdout_pipe[0], &readfds); } |