From 438b4ac2860f4aec5b5fb82c47f75a0cb80d9cb4 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 16 Mar 2014 12:34:53 +0100 Subject: script: make it work even if fd 0 is closed Testcase: script -q -c "echo hey" /dev/null 0>&- Signed-off-by: Denys Vlasenko --- libbb/getpty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libbb/getpty.c') diff --git a/libbb/getpty.c b/libbb/getpty.c index 435e4d09f..391d729f2 100644 --- a/libbb/getpty.c +++ b/libbb/getpty.c @@ -16,7 +16,7 @@ int FAST_FUNC xgetpty(char *line) #if ENABLE_FEATURE_DEVPTS p = open("/dev/ptmx", O_RDWR); - if (p > 0) { + if (p >= 0) { grantpt(p); /* chmod+chown corresponding slave pty */ unlockpt(p); /* (what does this do?) */ # ifndef HAVE_PTSNAME_R -- cgit v1.2.3