diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2014-10-09 06:20:02 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2014-10-09 06:20:02 +0000 |
commit | 1c684fc10a6a87d62e7c474da0904b8d2dcf3dcd (patch) | |
tree | da370d938726481193b71db17f17f4a6bb3a2bef /lib/libc | |
parent | 2165c5880a0c759ff9e7e6861c2d88517252441a (diff) |
replace the use of select() for a short sleep with nanosleep().
ok deraadt@ guenther@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/termios/tcsendbreak.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libc/termios/tcsendbreak.c b/lib/libc/termios/tcsendbreak.c index 79e80f5958b..796684a7881 100644 --- a/lib/libc/termios/tcsendbreak.c +++ b/lib/libc/termios/tcsendbreak.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcsendbreak.c,v 1.6 2005/08/05 13:03:00 espie Exp $ */ +/* $OpenBSD: tcsendbreak.c,v 1.7 2014/10/09 06:20:01 dlg Exp $ */ /*- * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -43,13 +43,14 @@ int tcsendbreak(int fd, int len) { - struct timeval sleepytime; + struct timespec sleepytime; sleepytime.tv_sec = 0; - sleepytime.tv_usec = 400000; + sleepytime.tv_nsec = 400000000; + if (ioctl(fd, TIOCSBRK, 0) == -1) return (-1); - (void)select(0, 0, 0, 0, &sleepytime); + (void)nanosleep(&sleepytime, NULL); if (ioctl(fd, TIOCCBRK, 0) == -1) return (-1); return (0); |