[hackers] [ubase] Don't do a blocking open in ttytostr() || sin

From: <git_AT_suckless.org>
Date: Fri, 16 Jan 2015 17:20:21 +0100 (CET)

commit f701698297ec1d1230caaa9403362c3a2b95f5ed
Author: sin <sin_AT_2f30.org>
Date: Fri Jan 16 16:19:29 2015 +0000

    Don't do a blocking open in ttytostr()

diff --git a/libutil/tty.c b/libutil/tty.c
index 0197f7e..bceb01e 100644
--- a/libutil/tty.c
+++ b/libutil/tty.c
_AT_@ -72,7 +72,7 @@ ttytostr(int tty_maj, int tty_min, char *str, size_t n)
 
                 if ((int)major(sb.st_rdev) == tty_maj &&
                     (int)minor(sb.st_rdev) == tty_min) {
- fd = open(path, O_RDONLY);
+ fd = open(path, O_RDONLY | O_NONBLOCK);
                         if (fd < 0)
                                 continue;
                         if (isatty(fd)) {
Received on Fri Jan 16 2015 - 17:20:21 CET

This archive was generated by hypermail 2.3.0 : Fri Jan 16 2015 - 17:24:09 CET