summaryrefslogtreecommitdiffstats
path: root/loader2/moduleinfo.c
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-02-04 17:20:12 +0000
committerJeremy Katz <katzj@redhat.com>2003-02-04 17:20:12 +0000
commit5011f9dd55e2d243fb35daae42c7958bd8fe07dd (patch)
treedb68a5c537a970b8583d55dca9c02a11156e8085 /loader2/moduleinfo.c
parent86597b3173a905a1c00feac26818db4551ccad30 (diff)
downloadanaconda-5011f9dd55e2d243fb35daae42c7958bd8fe07dd.tar.gz
anaconda-5011f9dd55e2d243fb35daae42c7958bd8fe07dd.tar.xz
anaconda-5011f9dd55e2d243fb35daae42c7958bd8fe07dd.zip
handle the case of not overriding a module with a new moduleball correctly
(for the case of the second stage modules.cgz which should never override things from stage1 which are likely to be driver disks). (#82314, #83128)
Diffstat (limited to 'loader2/moduleinfo.c')
-rw-r--r--loader2/moduleinfo.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/loader2/moduleinfo.c b/loader2/moduleinfo.c
index df63c9902..ad8d58e3b 100644
--- a/loader2/moduleinfo.c
+++ b/loader2/moduleinfo.c
@@ -84,12 +84,13 @@ moduleInfoSet newModuleInfoSet(void) {
int readModuleInfo(const char * filename, moduleInfoSet mis,
void * location, int override) {
int fd, isIndented;
- char * buf, * start, * next, * chptr;
+ char * buf, * start, * next = NULL, * chptr;
struct stat sb;
char oldch;
struct moduleInfo * nextModule;
int modulesAlloced;
int i;
+ int found = 0, skipModule = 0;
fd = open(filename, O_RDONLY);
if (fd < 0) return -1;
@@ -143,30 +144,39 @@ int readModuleInfo(const char * filename, moduleInfoSet mis,
}
nextModule = NULL;
- if (override) {
- for (i = 0; i < mis->numModules; i++) {
- if (!strcmp(mis->moduleList[i].moduleName, start)) {
+ found = 0;
+ skipModule = 0;
+ for (i = 0; i < mis->numModules; i++) {
+ if (!strcmp(mis->moduleList[i].moduleName, start)) {
+ if (override)
nextModule = mis->moduleList + i;
- break;
- }
+ else
+ skipModule = 1;
+ found = 1;
+ break;
}
}
- if (!nextModule) {
+ if (!found && !nextModule) {
nextModule = mis->moduleList + mis->numModules;
nextModule->moduleName = strdup(start);
}
- nextModule->major = DRIVER_NONE;
- nextModule->minor = DRIVER_MINOR_NONE;
- nextModule->description = NULL;
- nextModule->flags = 0;
- nextModule->args = NULL;
- nextModule->numArgs = 0;
- nextModule->locationID = location;
- } else if (!nextModule) {
+ if (nextModule) {
+ nextModule->major = DRIVER_NONE;
+ nextModule->minor = DRIVER_MINOR_NONE;
+ nextModule->description = NULL;
+ nextModule->flags = 0;
+ nextModule->args = NULL;
+ nextModule->numArgs = 0;
+ nextModule->locationID = location;
+ }
+ } else if (!nextModule && skipModule) {
+ /* we're skipping this one (not overriding), do nothing */
+ } else if (!nextModule && skipModule) {
/* ACK! syntax error */
+ fprintf(stderr, "module-info syntax error in %s\n", filename);
return 1;
} else if (nextModule->major == DRIVER_NONE) {
chptr = start + strlen(start) - 1;