summaryrefslogtreecommitdiffstats
path: root/release/sysinstall
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1997-02-15 12:24:02 +0000
committerjkh <jkh@FreeBSD.org>1997-02-15 12:24:02 +0000
commitd259caf3f57b7193480d94a29a3ff72c269f5f0e (patch)
tree5d85adef36095248ea0e50222cd5e80de0a1f13d /release/sysinstall
parentfa88f399c7777dd4396a188ce23195c697392b6b (diff)
downloadFreeBSD-src-d259caf3f57b7193480d94a29a3ff72c269f5f0e.zip
FreeBSD-src-d259caf3f57b7193480d94a29a3ff72c269f5f0e.tar.gz
Only add interface lines if they're not there already.
Diffstat (limited to 'release/sysinstall')
-rw-r--r--release/sysinstall/config.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/release/sysinstall/config.c b/release/sysinstall/config.c
index 31dba62..2ef56a2 100644
--- a/release/sysinstall/config.c
+++ b/release/sysinstall/config.c
@@ -376,25 +376,31 @@ configSysconfig(char *config)
fp = fopen(config, "w");
}
for (i = 0; i < nlines; i++) {
- static Boolean firstTime = TRUE;
-
fprintf(fp, lines[i]);
/* Stand by for bogus special case handling - we try to dump the interface specs here */
- if (firstTime && !strncmp(lines[i], VAR_INTERFACES, strlen(VAR_INTERFACES))) {
+ if (!strncmp(lines[i], VAR_INTERFACES, strlen(VAR_INTERFACES))) {
Device **devp;
int j, cnt;
devp = deviceFind(NULL, DEVICE_TYPE_NETWORK);
cnt = deviceCount(devp);
for (j = 0; j < cnt; j++) {
- char iname[255];
+ char iname[255], toadd[512];
+ int k, addit = TRUE;
snprintf(iname, 255, "%s%s", VAR_IFCONFIG, devp[j]->name);
if ((cp = variable_get(iname))) {
- fprintf(fp, "%s=\"%s\"\n", iname, cp);
+ snprintf(toadd, sizeof toadd, "%s=\"%s\"\n", iname, cp);
+ for (k = 0; k < nlines; k++) {
+ if (!strcmp(lines[k], toadd)) {
+ addit = FALSE;
+ break;
+ }
+ }
+ if (addit)
+ fprintf(fp, toadd);
}
}
- firstTime = FALSE;
}
free(lines[i]);
}
OpenPOWER on IntegriCloud