Don't do a blocking open in ttytostr() - ubase - suckless linux base utils | |
git clone git://git.suckless.org/ubase | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit f701698297ec1d1230caaa9403362c3a2b95f5ed | |
parent a7a561ef008ea0842b54713434d5f3fd79e8ccec | |
Author: sin <[email protected]> | |
Date: Fri, 16 Jan 2015 16:19:29 +0000 | |
Don't do a blocking open in ttytostr() | |
Diffstat: | |
M libutil/tty.c | 2 +- | |
1 file changed, 1 insertion(+), 1 deletion(-) | |
--- | |
diff --git a/libutil/tty.c b/libutil/tty.c | |
@@ -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)) { |