Skip to content

Commit

Permalink
n_hdlc: honor O_NONBLOCK on write
Browse files Browse the repository at this point in the history
Make n_hdlc line discipline honor the O_NONBLOCK file flag on write.

Signed-off-by: Paul Fulghum <paulkf@microgate.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Paul Fulghum authored and Linus Torvalds committed Jul 22, 2008
1 parent 768aec0 commit c72f527
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/char/n_hdlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c72f527

Please sign in to comment.