aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/ifupdown.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index 0c822e2a1..5b2251777 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -1239,8 +1239,10 @@ int ifupdown_main(int argc, char **argv)
1239 if (!okay && !FORCE) { 1239 if (!okay && !FORCE) {
1240 bb_error_msg("ignoring unknown interface %s", liface); 1240 bb_error_msg("ignoring unknown interface %s", liface);
1241 any_failures = 1; 1241 any_failures = 1;
1242 } else { 1242 } else if (!NO_ACT) {
1243 /* update the state file */ 1243 /* update the state file */
1244 FILE *state_fp;
1245 llist_t *state;
1244 llist_t *state_list = read_iface_state(); 1246 llist_t *state_list = read_iface_state();
1245 llist_t *iface_state = find_iface_state(state_list, iface); 1247 llist_t *iface_state = find_iface_state(state_list, iface);
1246 1248
@@ -1259,17 +1261,15 @@ int ifupdown_main(int argc, char **argv)
1259 } 1261 }
1260 1262
1261 /* Actually write the new state */ 1263 /* Actually write the new state */
1262 if (!NO_ACT) { 1264 state_fp = xfopen("/var/run/ifstate", "w");
1263 FILE *state_fp = xfopen("/var/run/ifstate", "w"); 1265 state = state_list;
1264 llist_t *state = state_list; 1266 while (state) {
1265 while (state) { 1267 if (state->data) {
1266 if (state->data) { 1268 fprintf(state_fp, "%s\n", state->data);
1267 fprintf(state_fp, "%s\n", state->data);
1268 }
1269 state = state->link;
1270 } 1269 }
1271 fclose(state_fp); 1270 state = state->link;
1272 } 1271 }
1272 fclose(state_fp);
1273 llist_free(state_list, free); 1273 llist_free(state_list, free);
1274 } 1274 }
1275 } 1275 }