Reset only ifcfg file of device we failed to activate (#638131)
Not of all devices, e.g those brought up before activating
devices from kickstart.
---
loader/net.c | 114 +++++++++++++++++++++++++++++++++-------------------------
loader/net.h | 2 +
2 files changed, 67 insertions(+), 49 deletions(-)
diff --git a/loader/net.c b/loader/net.c
index 42ff751..fa3d4dd 100644
--- a/loader/net.c
+++ b/loader/net.c
@@ -1158,10 +1158,7 @@ int manualNetConfig(char * device, iface_t * iface,
* bring up the ones the user wants.
*/
int writeDisabledNetInfo(void) {
- int i = 0;
- char *ofile = NULL;
- char *nfile = NULL;
- FILE *fp = NULL;
+ int i = 0, rc;
struct device **devs = NULL;
devs = getDevices(DEVICE_NETWORK);
@@ -1172,59 +1169,74 @@ int writeDisabledNetInfo(void) {
for (i = 0; devs[i]; i++) {
/* remove dhclient-DEVICE.conf if we have it */
- if (asprintf(&ofile, "/etc/dhcp/dhclient-%s.conf", devs[i]->device) == -1) {
- return 5;
+ if ((rc = removeDhclientConfFile(devs[i]->device)) != 0) {
+ return rc;
}
-
- if (!access(ofile, R_OK|W_OK)) {
- if (unlink(ofile)) {
- logMessage(ERROR, "error removing %s", ofile);
- }
+ /* write disabled ifcfg-DEVICE file */
+ if ((rc = writeDisabledIfcfgFile(devs[i]->device)) != 0) {
+ return rc;
}
+ }