mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zipl: fix handling of values with load address in BLS
Various keywords (like image or ramdisk) allow specifying a load address
as an optional argument. Adapt the logic for checking the presence of
the files to take this into the account.
Fixes: d71628326d
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1772054
Closes: #76
Signed-off-by: Dan Horák <dan@danny.cz>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
@@ -1575,6 +1575,8 @@ scan_check_bls(struct scan_token *scan)
|
||||
int i, rc;
|
||||
char *target_value = NULL;
|
||||
char *img_value = NULL;
|
||||
char *file = NULL;
|
||||
char *tmp, *value;
|
||||
/*
|
||||
* In the BLS case, each BLS section heading inherits a keyword
|
||||
* assignment target= from zipl.conf, and they are all the same.
|
||||
@@ -1595,19 +1597,37 @@ scan_check_bls(struct scan_token *scan)
|
||||
if (scan[i].content.keyword.keyword == scan_keyword_image ||
|
||||
scan[i].content.keyword.keyword == scan_keyword_ramdisk) {
|
||||
|
||||
rc = misc_check_readable_file(
|
||||
scan[i].content.keyword.value);
|
||||
value = scan[i].content.keyword.value;
|
||||
/*
|
||||
* put the filename only into the file var before
|
||||
* checking its presence
|
||||
*/
|
||||
if (contains_address(value)) {
|
||||
tmp = strrchr(value, ',');
|
||||
file = strndup(value, tmp - value);
|
||||
} else {
|
||||
file = value;
|
||||
}
|
||||
rc = misc_check_readable_file(file);
|
||||
if (rc) {
|
||||
misc_asprintf(&img_value, "%s%s",
|
||||
target_value,
|
||||
scan[i].content.keyword.value);
|
||||
target_value, file);
|
||||
rc = misc_check_readable_file(img_value);
|
||||
if (rc) {
|
||||
error_reason(
|
||||
"Image file '%s' is not accessible",
|
||||
scan[i].content.keyword.value);
|
||||
"File '%s' not accessible", file);
|
||||
return rc;
|
||||
}
|
||||
/*
|
||||
* when file has stripped the load address part,
|
||||
* do generate a prefixed value
|
||||
*/
|
||||
if (file != value) {
|
||||
free(file);
|
||||
free(img_value);
|
||||
misc_asprintf(&img_value, "%s%s",
|
||||
target_value, value);
|
||||
}
|
||||
free(scan[i].content.keyword.value);
|
||||
scan[i].content.keyword.value = img_value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user