[PATCH 2/2] cr: bugfixes of oren's code

Serge E. Hallyn serue at us.ibm.com
Tue Sep 1 18:34:12 PDT 2009


Signed-off-by: Serge E. Hallyn <serue at us.ibm.com>
---
 drivers/char/tty_io.c          |    6 +++++-
 include/linux/checkpoint_hdr.h |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 9d98bb8..b8f8d79 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -2730,7 +2730,11 @@ static int checkpoint_tty_ldisc(struct ckpt_ctx *ctx, struct tty_struct *tty)
 	h->column = tty->column;
 	h->datalen = tty->read_cnt;
 	h->canon_column = tty->canon_column;
-	h->canon_datalen = tty->canon_head - tty->read_tail;
+	h->canon_datalen = tty->canon_head;
+	if (tty->canon_head > tty->read_tail)
+		h->canon_datalen -= tty->read_tail;
+	else
+		h->canon_datalen += N_TTY_BUF_SIZE - tty->read_tail;
 	h->canon_data = tty->canon_data;
 
 	datalen = tty->read_cnt;
diff --git a/include/linux/checkpoint_hdr.h b/include/linux/checkpoint_hdr.h
index 5febdc7..492b4d5 100644
--- a/include/linux/checkpoint_hdr.h
+++ b/include/linux/checkpoint_hdr.h
@@ -688,7 +688,7 @@ struct ckpt_hdr_ldisc_n_tty {
 	struct ckpt_hdr h;
 
 	__u32 column;
-	__u32 datalen;
+	__s32 datalen;
 	__u32 canon_column;
 	__u32 canon_datalen;
 	__u32 canon_data;
-- 
1.6.1


--M9NhX3UHpAaciwkO--


More information about the Containers mailing list