summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-12-10 14:14:09 +0000
committerDenis Vlasenko2008-12-10 14:14:09 +0000
commit12abcb36c871f4c97d7aed3d9bd55e5477888bb7 (patch)
treed526460c2d752fca87fb8735c5ce3dbc0d9caade
parent311c19a661fb8e8cc85d131c1b87a6b80a89ef7c (diff)
downloadbusybox-12abcb36c871f4c97d7aed3d9bd55e5477888bb7.zip
busybox-12abcb36c871f4c97d7aed3d9bd55e5477888bb7.tar.gz
libiproute: fix buggy open check: s/if (fd)/if (fd >= 0)/
less: small optimization -15 bytes
-rw-r--r--miscutils/less.c4
-rw-r--r--networking/libiproute/ll_map.c2
2 files changed, 2 insertions, 4 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 */
diff --git a/networking/libiproute/ll_map.c b/networking/libiproute/ll_map.c
index 3412dc7..2ed7fbb 100644
--- a/networking/libiproute/ll_map.c
+++ b/networking/libiproute/ll_map.c
@@ -172,7 +172,7 @@ int xll_name_to_index(const char *const name)
#endif
sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
- if (sock_fd) {
+ if (sock_fd >= 0) {
struct ifreq ifr;
int tmp;