svn commit: trunk/busybox/networking

landley at busybox.net landley at busybox.net
Sun Feb 26 04:42:10 UTC 2006


Author: landley
Date: 2006-02-25 20:42:05 -0800 (Sat, 25 Feb 2006)
New Revision: 14294

Log:
Patch from Glenn McGrath to remove code that opens a file but does nothing
with it.


Modified:
   trunk/busybox/networking/ifupdown.c


Changeset:
Modified: trunk/busybox/networking/ifupdown.c
===================================================================
--- trunk/busybox/networking/ifupdown.c	2006-02-26 04:37:04 UTC (rev 14293)
+++ trunk/busybox/networking/ifupdown.c	2006-02-26 04:42:05 UTC (rev 14294)
@@ -1157,7 +1157,6 @@
 {
 	int (*cmds) (struct interface_defn_t *) = NULL;
 	struct interfaces_file_t *defn;
-	FILE *state_fp = NULL;
 	llist_t *state_list = NULL;
 	llist_t *target_list = NULL;
 	const char *interfaces = "/etc/network/interfaces";
@@ -1230,10 +1229,6 @@
 		exit(EXIT_FAILURE);
 	}
 
-	if (no_act) {
-		state_fp = fopen(statefile, "r");
-	}
-
 	/* Create a list of interfaces to work on */
 	if (do_all) {
 		if (cmds == iface_up) {
@@ -1398,9 +1393,8 @@
 
 	/* Actually write the new state */
 	if (!no_act) {
+		FILE *state_fp = NULL;
 
-		if (state_fp)
-			fclose(state_fp);
 		state_fp = bb_xfopen(statefile, "a+");
 
 		if (ftruncate(fileno(state_fp), 0) < 0) {
@@ -1417,12 +1411,7 @@
 			state_list = state_list->link;
 		}
 		fflush(state_fp);
-	}
-
-	/* Cleanup */
-	if (state_fp != NULL) {
 		fclose(state_fp);
-		state_fp = NULL;
 	}
 
 	if (any_failures)




More information about the busybox-cvs mailing list