patch-2.2.7 linux/drivers/char/n_tty.c

Next file: linux/drivers/char/pc_keyb.c
Previous file: linux/drivers/char/mem.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.6/linux/drivers/char/n_tty.c linux/drivers/char/n_tty.c
@@ -922,8 +922,14 @@
 		}
 	}
 
-	if (down_interruptible(&tty->atomic_read))
-		return -ERESTARTSYS;
+	if (file->f_flags & O_NONBLOCK) {
+		if (down_trylock(&tty->atomic_read))
+			return -EAGAIN;
+	}
+	else {
+		if (down_interruptible(&tty->atomic_read))
+			return -ERESTARTSYS;
+	}
 
 	add_wait_queue(&tty->read_wait, &wait);
 	set_bit(TTY_DONT_FLIP, &tty->flags);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)