From 12abcb36c871f4c97d7aed3d9bd55e5477888bb7 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Wed, 10 Dec 2008 14:14:09 +0000 Subject: libiproute: fix buggy open check: s/if (fd)/if (fd >= 0)/ less: small optimization -15 bytes --- miscutils/less.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'miscutils') 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 */ -- cgit v1.1