mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-27 05:21:08 +01:00
Only add interface lines if they're not there already.
This commit is contained in:
parent
80671631f8
commit
136b318913
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=22745
@ -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]);
|
||||
}
|
||||
|
@ -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]);
|
||||
}
|
||||
|
@ -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]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user