Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <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>

authored by

Paul Fulghum and committed by
Linus Torvalds
c72f527c 768aec0b

+4
+4
drivers/char/n_hdlc.c
··· 677 677 /* Allocate transmit buffer */ 678 678 /* sleep until transmit buffer available */ 679 679 while (!(tbuf = n_hdlc_buf_get(&n_hdlc->tx_free_buf_list))) { 680 + if (file->f_flags & O_NONBLOCK) { 681 + error = -EAGAIN; 682 + break; 683 + } 680 684 schedule(); 681 685 682 686 n_hdlc = tty2n_hdlc (tty);