aboutsummaryrefslogtreecommitdiff
path: root/libbb/getpty.c
diff options
context:
space:
mode:
authorGravatar Denys Vlasenko <vda.linux@googlemail.com>2014-03-16 12:34:53 +0100
committerGravatar Denys Vlasenko <vda.linux@googlemail.com>2014-03-16 12:34:53 +0100
commit438b4ac2860f4aec5b5fb82c47f75a0cb80d9cb4 (patch)
tree83dd96e62dfe975fa9ea3f738fe32e220862b2fa /libbb/getpty.c
parent29f352604868c5d17c81948ea30e332491cecada (diff)
downloadbusybox-438b4ac2860f4aec5b5fb82c47f75a0cb80d9cb4.tar.gz
busybox-438b4ac2860f4aec5b5fb82c47f75a0cb80d9cb4.tar.bz2
script: make it work even if fd 0 is closed
Testcase: script -q -c "echo hey" /dev/null 0>&- Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/getpty.c')
-rw-r--r--libbb/getpty.c2
1 files changed, 1 insertions, 1 deletions
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