aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-02-26 04:42:05 +0000
committerRob Landley <rob@landley.net>2006-02-26 04:42:05 +0000
commit4217bab02edbc418b0346e222de32448e3390421 (patch)
tree9d6631050c43548bab67c178a0635b26a213f14b
parent5ba2fb2c9dd23d99ebf69e0e71b4b6a845fb8eab (diff)
downloadbusybox-4217bab02edbc418b0346e222de32448e3390421.tar.gz
Patch from Glenn McGrath to remove code that opens a file but does nothing
with it.
-rw-r--r--networking/ifupdown.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 34a43e6fa..ad9b99b55 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -1157,7 +1157,6 @@ extern int ifupdown_main(int argc, char **argv)
{
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 @@ extern int ifupdown_main(int argc, char **argv)
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 @@ extern int ifupdown_main(int argc, char **argv)
/* 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 @@ extern int ifupdown_main(int argc, char **argv)
state_list = state_list->link;
}
fflush(state_fp);
- }
-
- /* Cleanup */
- if (state_fp != NULL) {
fclose(state_fp);
- state_fp = NULL;
}
if (any_failures)