Re: small patch for pty.c

From: Paul Mackerras (paulus@linuxcare.com)
Date: Mon Apr 17 2000 - 19:37:48 EST


Stephen Rothwell just pointed out to me that my pty.c patch was bogus.
The first section was fine, the second section was just plain wrong.
Here is a better patch. :-)

Paul.

diff -urN official/drivers/char/pty.c linux/drivers/char/pty.c
--- official/drivers/char/pty.c Thu Apr 13 10:25:09 2000
+++ linux/drivers/char/pty.c Tue Apr 18 09:27:25 2000
@@ -138,7 +138,7 @@
                        const unsigned char *buf, int count)
 {
         struct tty_struct *to = tty->link;
- int c=0, n;
+ int c=0, n, room;
         char *temp_buffer;
 
         if (!to || tty->stopped)
@@ -149,7 +149,9 @@
                 temp_buffer = &tty->flip.char_buf[0];
                 while (count > 0) {
                         /* check space so we don't copy needlessly */
- n = MIN(count, to->ldisc.receive_room(to));
+ n = to->ldisc.receive_room(to);
+ if (n > count)
+ n = count;
                         if (!n) break;
 
                         n = MIN(n, PTY_BUF_SIZE);
@@ -161,7 +163,9 @@
                         }
 
                         /* check again in case the buffer filled up */
- n = MIN(n, to->ldisc.receive_room(to));
+ room = to->ldisc.receive_room(to);
+ if (n > room)
+ n = room;
                         if (!n) break;
                         buf += n;
                         c += n;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:12 EST