svn commit: trunk/busybox: include libbb loginutils miscutils netwo etc...

vda at busybox.net vda at busybox.net
Sun Aug 19 13:42:10 UTC 2007


Author: vda
Date: 2007-08-19 06:42:08 -0700 (Sun, 19 Aug 2007)
New Revision: 19559

Log:
libbb,crond,lash: fix getopt32 (don't know how it managed to slip through)
*: fcntl(fd, F_GETFL) doesn't require third parameter at all.



Modified:
   trunk/busybox/include/libbb.h
   trunk/busybox/libbb/xfuncs.c
   trunk/busybox/loginutils/getty.c
   trunk/busybox/miscutils/crond.c
   trunk/busybox/networking/isrv.c
   trunk/busybox/networking/isrv_identd.c
   trunk/busybox/runit/svlogd.c
   trunk/busybox/shell/ash.c
   trunk/busybox/shell/lash.c


Changeset:
Modified: trunk/busybox/include/libbb.h
===================================================================
--- trunk/busybox/include/libbb.h	2007-08-18 15:48:00 UTC (rev 19558)
+++ trunk/busybox/include/libbb.h	2007-08-19 13:42:08 UTC (rev 19559)
@@ -611,8 +611,7 @@
 extern const char *applet_long_options;
 #endif
 extern uint32_t option_mask32;
-/* TODO: don't pass argc, determine it by looking at argv */
-extern uint32_t getopt32(int argc, char **argv, const char *applet_opts, ...);
+extern uint32_t getopt32(char **argv, const char *applet_opts, ...);
 
 
 typedef struct llist_t {

Modified: trunk/busybox/libbb/xfuncs.c
===================================================================
--- trunk/busybox/libbb/xfuncs.c	2007-08-18 15:48:00 UTC (rev 19558)
+++ trunk/busybox/libbb/xfuncs.c	2007-08-19 13:42:08 UTC (rev 19559)
@@ -161,12 +161,12 @@
 // Turn on nonblocking I/O on a fd
 int ndelay_on(int fd)
 {
-	return fcntl(fd, F_SETFL, fcntl(fd,F_GETFL,0) | O_NONBLOCK);
+	return fcntl(fd, F_SETFL, fcntl(fd,F_GETFL) | O_NONBLOCK);
 }
 
 int ndelay_off(int fd)
 {
-	return fcntl(fd, F_SETFL, fcntl(fd,F_GETFL,0) & ~O_NONBLOCK);
+	return fcntl(fd, F_SETFL, fcntl(fd,F_GETFL) & ~O_NONBLOCK);
 }
 
 void xdup2(int from, int to)

Modified: trunk/busybox/loginutils/getty.c
===================================================================
--- trunk/busybox/loginutils/getty.c	2007-08-18 15:48:00 UTC (rev 19558)
+++ trunk/busybox/loginutils/getty.c	2007-08-19 13:42:08 UTC (rev 19559)
@@ -232,13 +232,11 @@
 	int chdir_to_root = 0;
 
 	/* Set up new standard input, unless we are given an already opened port. */
-
 	if (NOT_LONE_DASH(tty)) {
 		struct stat st;
 		int fd;
 
 		/* Sanity checks... */
-
 		xchdir("/dev");
 		chdir_to_root = 1;
 		xstat(tty, &st);
@@ -246,18 +244,17 @@
 			bb_error_msg_and_die("%s: not a character device", tty);
 
 		/* Open the tty as standard input. */
-
 		debug("open(2)\n");
 		fd = xopen(tty, O_RDWR | O_NONBLOCK);
 		xdup2(fd, 0);
-		while (fd > 2) close(fd--);
+		while (fd > 2)
+			close(fd--);
 	} else {
 		/*
 		 * Standard input should already be connected to an open port. Make
 		 * sure it is open for read/write.
 		 */
-
-		if ((fcntl(0, F_GETFL, 0) & O_RDWR) != O_RDWR)
+		if ((fcntl(0, F_GETFL) & O_RDWR) != O_RDWR)
 			bb_error_msg_and_die("stdin is not open for read/write");
 	}
 
@@ -274,7 +271,6 @@
 	 * by patching the SunOS kernel variable "zsadtrlow" to a larger value;
 	 * 5 seconds seems to be a good value.
 	 */
-
 	ioctl_or_perror_and_die(0, TCGETS, tp, "%s: TCGETS", tty);
 
 	/*
@@ -362,7 +358,7 @@
 	ioctl(0, TCSETS, tp);
 
 	/* go to blocking input even in local mode */
-	fcntl(0, F_SETFL, fcntl(0, F_GETFL, 0) & ~O_NONBLOCK);
+	ndelay_off(0);
 
 	debug("term_io 2\n");
 }
@@ -791,7 +787,7 @@
 
 	if (!(options.flags & F_LOCAL)) {
 		/* go to blocking write mode unless -L is specified */
-		fcntl(1, F_SETFL, fcntl(1, F_GETFL, 0) & ~O_NONBLOCK);
+		ndelay_off(1);
 	}
 
 	/* Optionally detect the baud rate from the modem status message. */

Modified: trunk/busybox/miscutils/crond.c
===================================================================
--- trunk/busybox/miscutils/crond.c	2007-08-18 15:48:00 UTC (rev 19558)
+++ trunk/busybox/miscutils/crond.c	2007-08-19 13:42:08 UTC (rev 19559)
@@ -137,7 +137,7 @@
 
 	opt_complementary = "f-b:b-f:S-L:L-S" USE_DEBUG_CROND_OPTION(":d-l");
 	opterr = 0;			/* disable getopt 'errors' message. */
-	opt = getopt32(ac, av, "l:L:fbSc:" USE_DEBUG_CROND_OPTION("d:"),
+	opt = getopt32(av, "l:L:fbSc:" USE_DEBUG_CROND_OPTION("d:"),
 			&lopt, &Lopt, &copt USE_DEBUG_CROND_OPTION(, &dopt));
 	if (opt & 1) /* -l */
 		LogLevel = xatou(lopt);

Modified: trunk/busybox/networking/isrv.c
===================================================================
--- trunk/busybox/networking/isrv.c	2007-08-18 15:48:00 UTC (rev 19558)
+++ trunk/busybox/networking/isrv.c	2007-08-19 13:42:08 UTC (rev 19559)
@@ -301,7 +301,7 @@
 	isrv_want_rd(state, listen_fd);
 	/* remember flags to make blocking<->nonblocking switch faster */
 	/* (suppress gcc warning "cast from ptr to int of different size") */
-	PARAM_TBL[0] = (void*)(ptrdiff_t)(fcntl(listen_fd, F_GETFL, 0));
+	PARAM_TBL[0] = (void*)(ptrdiff_t)(fcntl(listen_fd, F_GETFL));
 
 	while (1) {
 		struct timeval tv;

Modified: trunk/busybox/networking/isrv_identd.c
===================================================================
--- trunk/busybox/networking/isrv_identd.c	2007-08-18 15:48:00 UTC (rev 19558)
+++ trunk/busybox/networking/isrv_identd.c	2007-08-19 13:42:08 UTC (rev 19559)
@@ -32,7 +32,7 @@
 	if (isrv_register_fd(state, peer, fd) < 0)
 		return peer; /* failure, unregister peer */
 
-	buf->fd_flag = fcntl(fd, F_GETFL, 0) | O_NONBLOCK;
+	buf->fd_flag = fcntl(fd, F_GETFL) | O_NONBLOCK;
 	isrv_want_rd(state, fd);
 	return 0;
 }

Modified: trunk/busybox/runit/svlogd.c
===================================================================
--- trunk/busybox/runit/svlogd.c	2007-08-18 15:48:00 UTC (rev 19558)
+++ trunk/busybox/runit/svlogd.c	2007-08-19 13:42:08 UTC (rev 19559)
@@ -800,7 +800,7 @@
 	/* We cannot set NONBLOCK on fd #0 permanently - this setting
 	 * _isn't_ per-process! It is shared among all other processes
 	 * with the same stdin */
-	fl_flag_0 = fcntl(0, F_GETFL, 0);
+	fl_flag_0 = fcntl(0, F_GETFL);
 
 	blocked_sigset = &ss;
 	sigemptyset(&ss);

Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c	2007-08-18 15:48:00 UTC (rev 19558)
+++ trunk/busybox/shell/ash.c	2007-08-19 13:42:08 UTC (rev 19559)
@@ -726,7 +726,7 @@
 		}
 	}
 #ifdef O_APPEND
-	flags = fcntl(fileno(tracefile), F_GETFL, 0);
+	flags = fcntl(fileno(tracefile), F_GETFL);
 	if (flags >= 0)
 		fcntl(fileno(tracefile), F_SETFL, flags | O_APPEND);
 #endif
@@ -8565,7 +8565,7 @@
 
 	if (nr < 0) {
 		if (parsefile->fd == 0 && errno == EWOULDBLOCK) {
-			int flags = fcntl(0, F_GETFL, 0);
+			int flags = fcntl(0, F_GETFL);
 			if (flags >= 0 && flags & O_NONBLOCK) {
 				flags &=~ O_NONBLOCK;
 				if (fcntl(0, F_SETFL, flags) >= 0) {

Modified: trunk/busybox/shell/lash.c
===================================================================
--- trunk/busybox/shell/lash.c	2007-08-18 15:48:00 UTC (rev 19558)
+++ trunk/busybox/shell/lash.c	2007-08-19 13:42:08 UTC (rev 19559)
@@ -1524,7 +1524,7 @@
 		}
 	}
 
-	opt = getopt32(argc_l, argv_l, "+ic:", &local_pending_command);
+	opt = getopt32(argv_l, "+ic:", &local_pending_command);
 #define LASH_OPT_i (1<<0)
 #define LASH_OPT_c (1<<1)
 	if (opt & LASH_OPT_c) {




More information about the busybox-cvs mailing list