Don't do a blocking open in ttytostr() - ubase - suckless linux base utils
HTML git clone git://git.suckless.org/ubase
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit f701698297ec1d1230caaa9403362c3a2b95f5ed
DIR parent a7a561ef008ea0842b54713434d5f3fd79e8ccec
HTML Author: sin <sin@2f30.org>
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(-)
---
DIR 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)) {