svn commit: trunk/busybox: miscutils networking/libiproute

vda at busybox.net vda at busybox.net
Wed Dec 10 14:14:09 UTC 2008


Author: vda
Date: 2008-12-10 06:14:09 -0800 (Wed, 10 Dec 2008)
New Revision: 24360

Log:
libiproute: fix buggy open check: s/if (fd)/if (fd >= 0)/
less: small optimization -15 bytes



Modified:
   trunk/busybox/miscutils/less.c
   trunk/busybox/networking/libiproute/ll_map.c


Changeset:
Modified: trunk/busybox/miscutils/less.c
===================================================================
--- trunk/busybox/miscutils/less.c	2008-12-10 13:46:19 UTC (rev 24359)
+++ trunk/busybox/miscutils/less.c	2008-12-10 14:14:09 UTC (rev 24360)
@@ -774,9 +774,7 @@
 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 */

Modified: trunk/busybox/networking/libiproute/ll_map.c
===================================================================
--- trunk/busybox/networking/libiproute/ll_map.c	2008-12-10 13:46:19 UTC (rev 24359)
+++ trunk/busybox/networking/libiproute/ll_map.c	2008-12-10 14:14:09 UTC (rev 24360)
@@ -172,7 +172,7 @@
 #endif
 
 	sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
-	if (sock_fd) {
+	if (sock_fd >= 0) {
 		struct ifreq ifr;
 		int tmp;
 




More information about the busybox-cvs mailing list