[PATCH] tty: Fix slave peer index accounting

Cyrill Gorcunov gorcunov at openvz.org
Tue Dec 11 11:52:30 EST 2012


We need to test every even index (which represents a slave
peer) thus use modulo operation here.

Reported-by: Alexander Kartashov <alekskartashov at parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 tty.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tty.c b/tty.c
index 5f30d89..f5f10f9 100644
--- a/tty.c
+++ b/tty.c
@@ -167,7 +167,7 @@ int tty_verify_active_pairs(void)
 	unsigned long i, unpaired_slaves = 0;
 
 	for_each_bit(i, tty_active_pairs) {
-		if (is_log2(i)) {
+		if ((i % 2) == 0) {
 			if (test_bit(i + 1, tty_active_pairs)) {
 				i++;
 				continue;
-- 
1.8.0.1


--sdtB3X0nJg68CQEu--


More information about the CRIU mailing list