summaryrefslogtreecommitdiff
path: root/lib/libc/termios/tcdrain.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/termios/tcdrain.c')
-rw-r--r--lib/libc/termios/tcdrain.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/libc/termios/tcdrain.c b/lib/libc/termios/tcdrain.c
index ac74b496fa8..f9ff00cb2ba 100644
--- a/lib/libc/termios/tcdrain.c
+++ b/lib/libc/termios/tcdrain.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcdrain.c,v 1.5 2005/08/05 13:03:00 espie Exp $ */
+/* $OpenBSD: tcdrain.c,v 1.6 2016/05/07 19:05:22 guenther Exp $ */
/*-
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -31,8 +31,15 @@
#include <sys/ioctl.h>
#include <termios.h>
+#include "cancel.h"
+
int
tcdrain(int fd)
{
- return (ioctl(fd, TIOCDRAIN, 0));
+ int ret;
+
+ ENTER_CANCEL_POINT(1);
+ ret = ioctl(fd, TIOCDRAIN, 0);
+ LEAVE_CANCEL_POINT(ret == -1);
+ return (ret);
}