zipl: fix BLS error message

Fix that a misleading BLS error message is printed in any case for missing
files.
The scan_check code in zipl already does proper error handling for missing
file. Remove the duplicated error handling from scan_check_bls and just use
the function to update the file with the target path if needed.
To indicate the intention of this function also rename it.

Fixes: #84

Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Tuan Hoang <tmhoang@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Stefan Haberland
2020-04-24 16:02:26 +02:00
committed by Jan Höppner
parent ae66f79512
commit d7b816ff58
3 changed files with 14 additions and 21 deletions

View File

@@ -126,7 +126,7 @@ char* scan_keyword_name(enum scan_keyword_id id);
int scan_check_defaultboot(struct scan_token* scan);
struct scan_token* scan_build_automenu(struct scan_token* scan);
int scan_check(struct scan_token* scan);
int scan_check_bls(struct scan_token *scan);
void scan_update_bls_path(struct scan_token *scan);
int scan_find_section(struct scan_token* scan, char* name, enum scan_id type,
int offset);
int scan_check_section_data(char* keyword[], int* line, char* name,

View File

@@ -1874,12 +1874,8 @@ get_job_from_config_file(struct command_line* cmdline, struct job_data* job)
scan_free(scan);
return rc;
}
rc = scan_check_bls(scan);
if (rc) {
error_text("BLS parsing '%s'", blsdir);
scan_free(scan);
return rc;
}
/* maybe we need to update bls search path with target path */
scan_update_bls_path(scan);
/* Get job from config file data */
if (cmdline->menu != NULL)
rc = get_menu_job(scan, cmdline->menu, job);

View File

@@ -1567,16 +1567,17 @@ scan_check(struct scan_token* scan)
/*
* Check if kernel and initrd image paths provided by BLS files are readable.
* If not, add value of 'scan_keyword_target' into search path and silently
* update scan list.
* update scan list if the file exists.
* In case neither path works the scan_check code will correctly handle missing
* files
*/
int
scan_check_bls(struct scan_token *scan)
void scan_update_bls_path(struct scan_token *scan)
{
int i, rc;
char *target_value = NULL;
char *img_value = NULL;
char *file = NULL;
char *tmp, *value;
int i;
/*
* In the BLS case, each BLS section heading inherits a keyword
* assignment target= from zipl.conf, and they are all the same.
@@ -1590,7 +1591,7 @@ scan_check_bls(struct scan_token *scan)
}
}
if (!target_value)
return -1;
return;
for (i = 0 ; scan[i].id != scan_id_empty; i++) {
if (scan[i].id != scan_id_keyword_assignment)
continue;
@@ -1608,16 +1609,12 @@ scan_check_bls(struct scan_token *scan)
} else {
file = value;
}
rc = misc_check_readable_file(file);
if (rc) {
if (misc_check_readable_file(file)) {
misc_asprintf(&img_value, "%s%s",
target_value, file);
rc = misc_check_readable_file(img_value);
if (rc) {
error_reason(
"File '%s' not accessible", file);
return rc;
}
if (misc_check_readable_file(img_value))
continue;
/*
* when file has stripped the load address part,
* do generate a prefixed value
@@ -1633,7 +1630,7 @@ scan_check_bls(struct scan_token *scan)
}
}
}
return 0;
return;
}
static int