summaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/less.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/miscutils/less.c b/miscutils/less.c
index 36d4512..27855bb 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -774,9 +774,7 @@ static void buffer_line(int linenum)
static void open_file_and_read_lines(void)
{
if (filename) {
- int fd = xopen(filename, O_RDONLY);
- dup2(fd, 0);
- if (fd) close(fd);
+ xmove_fd(xopen(filename, O_RDONLY), STDIN_FILENO);
} else {
/* "less" with no arguments in argv[] */
/* For status line only */