libiproute: fix buggy open check: s/if (fd)/if (fd >= 0)/

less: small optimization -15 bytes
This commit is contained in:
Denis Vlasenko
2008-12-10 14:14:09 +00:00
parent 311c19a661
commit 12abcb36c8
2 changed files with 2 additions and 4 deletions

View File

@ -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 */