diff options
Diffstat (limited to 'coreutils/stty.c')
-rw-r--r-- | coreutils/stty.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/coreutils/stty.c b/coreutils/stty.c index cb9b18361..f29fa64f7 100644 --- a/coreutils/stty.c +++ b/coreutils/stty.c | |||
@@ -1293,17 +1293,9 @@ int stty_main(int argc, char **argv) | |||
1293 | 1293 | ||
1294 | /* Now it is safe to start doing things */ | 1294 | /* Now it is safe to start doing things */ |
1295 | if (file_name) { | 1295 | if (file_name) { |
1296 | int fd, fdflags; | ||
1297 | G.device_name = file_name; | 1296 | G.device_name = file_name; |
1298 | fd = xopen_nonblocking(G.device_name); | 1297 | xmove_fd(xopen_nonblocking(G.device_name), STDIN_FILENO); |
1299 | if (fd != STDIN_FILENO) { | 1298 | ndelay_off(STDIN_FILENO); |
1300 | dup2(fd, STDIN_FILENO); | ||
1301 | close(fd); | ||
1302 | } | ||
1303 | fdflags = fcntl(STDIN_FILENO, F_GETFL); | ||
1304 | if (fdflags < 0 || | ||
1305 | fcntl(STDIN_FILENO, F_SETFL, fdflags & ~O_NONBLOCK) < 0) | ||
1306 | perror_on_device_and_die("%s: cannot reset non-blocking mode"); | ||
1307 | } | 1299 | } |
1308 | 1300 | ||
1309 | /* Initialize to all zeroes so there is no risk memcmp will report a | 1301 | /* Initialize to all zeroes so there is no risk memcmp will report a |