svn commit: trunk/busybox/networking
vda at busybox.net
vda at busybox.net
Wed May 2 15:22:23 PDT 2007
Author: vda
Date: 2007-05-02 15:22:23 -0700 (Wed, 02 May 2007)
New Revision: 18546
Log:
ifupdown: small optimization (avoid doing useless work if we are
not going to update state file)
Modified:
trunk/busybox/networking/ifupdown.c
Changeset:
Modified: trunk/busybox/networking/ifupdown.c
===================================================================
--- trunk/busybox/networking/ifupdown.c 2007-05-02 22:07:03 UTC (rev 18545)
+++ trunk/busybox/networking/ifupdown.c 2007-05-02 22:22:23 UTC (rev 18546)
@@ -1239,8 +1239,10 @@
if (!okay && !FORCE) {
bb_error_msg("ignoring unknown interface %s", liface);
any_failures = 1;
- } else {
+ } else if (!NO_ACT) {
/* update the state file */
+ FILE *state_fp;
+ llist_t *state;
llist_t *state_list = read_iface_state();
llist_t *iface_state = find_iface_state(state_list, iface);
@@ -1259,17 +1261,15 @@
}
/* Actually write the new state */
- if (!NO_ACT) {
- FILE *state_fp = xfopen("/var/run/ifstate", "w");
- llist_t *state = state_list;
- while (state) {
- if (state->data) {
- fprintf(state_fp, "%s\n", state->data);
- }
- state = state->link;
+ state_fp = xfopen("/var/run/ifstate", "w");
+ state = state_list;
+ while (state) {
+ if (state->data) {
+ fprintf(state_fp, "%s\n", state->data);
}
- fclose(state_fp);
+ state = state->link;
}
+ fclose(state_fp);
llist_free(state_list, free);
}
}
More information about the busybox-cvs
mailing list