diff options
-rw-r--r-- | libbb/getpty.c | 2 | ||||
-rw-r--r-- | util-linux/script.c | 7 |
2 files changed, 8 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) | |||
16 | 16 | ||
17 | #if ENABLE_FEATURE_DEVPTS | 17 | #if ENABLE_FEATURE_DEVPTS |
18 | p = open("/dev/ptmx", O_RDWR); | 18 | p = open("/dev/ptmx", O_RDWR); |
19 | if (p > 0) { | 19 | if (p >= 0) { |
20 | grantpt(p); /* chmod+chown corresponding slave pty */ | 20 | grantpt(p); /* chmod+chown corresponding slave pty */ |
21 | unlockpt(p); /* (what does this do?) */ | 21 | unlockpt(p); /* (what does this do?) */ |
22 | # ifndef HAVE_PTSNAME_R | 22 | # ifndef HAVE_PTSNAME_R |
diff --git a/util-linux/script.c b/util-linux/script.c index 8fb991d15..abcd73bff 100644 --- a/util-linux/script.c +++ b/util-linux/script.c | |||
@@ -77,8 +77,15 @@ int script_main(int argc UNUSED_PARAM, char **argv) | |||
77 | if (!(opt & OPT_q)) { | 77 | if (!(opt & OPT_q)) { |
78 | printf("Script started, file is %s\n", fname); | 78 | printf("Script started, file is %s\n", fname); |
79 | } | 79 | } |
80 | |||
80 | shell = get_shell_name(); | 81 | shell = get_shell_name(); |
81 | 82 | ||
83 | /* Some people run "script ... 0>&-". | ||
84 | * Our code assumes that STDIN_FILENO != pty. | ||
85 | * Ensure STDIN_FILENO is not closed: | ||
86 | */ | ||
87 | bb_sanitize_stdio(); | ||
88 | |||
82 | pty = xgetpty(pty_line); | 89 | pty = xgetpty(pty_line); |
83 | 90 | ||
84 | /* get current stdin's tty params */ | 91 | /* get current stdin's tty params */ |