From: Paul Fulghum Date: Tue, 22 Jul 2008 10:21:19 +0000 (+0100) Subject: n_hdlc: honor O_NONBLOCK on write X-Git-Tag: v2.6.27-rc1~875 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c72f527c104cae8e767e714574238b5550879e0c;p=linux-2.6 n_hdlc: honor O_NONBLOCK on write Make n_hdlc line discipline honor the O_NONBLOCK file flag on write. Signed-off-by: Paul Fulghum Signed-off-by: Andrew Morton Signed-off-by: Alan Cox Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index ed4e03333a..69ec6399c7 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c @@ -677,6 +677,10 @@ static ssize_t n_hdlc_tty_write(struct tty_struct *tty, struct file *file, /* Allocate transmit buffer */ /* sleep until transmit buffer available */ while (!(tbuf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list))) { + if (file->f_flags & O_NONBLOCK) { + error = -EAGAIN; + break; + } schedule(); n_hdlc = tty2n_hdlc (tty);