libfdisk: support unknown partition types in sfdisk scripts
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1183234 Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
9bd2906012
commit
bf031d89ea
|
@ -715,9 +715,9 @@ static int command_parttype(struct sfdisk *sf, int argc, char **argv)
|
||||||
if (sf->backup)
|
if (sf->backup)
|
||||||
backup_partition_table(sf, devname);
|
backup_partition_table(sf, devname);
|
||||||
|
|
||||||
/* parse <type> and apply yo PT */
|
/* parse <type> and apply to PT */
|
||||||
type = fdisk_label_parse_parttype(lb, typestr);
|
type = fdisk_label_parse_parttype(lb, typestr);
|
||||||
if (!type || fdisk_parttype_is_unknown(type))
|
if (!type)
|
||||||
errx(EXIT_FAILURE, _("failed to parse %s partition type '%s'"),
|
errx(EXIT_FAILURE, _("failed to parse %s partition type '%s'"),
|
||||||
fdisk_label_get_name(lb), typestr);
|
fdisk_label_get_name(lb), typestr);
|
||||||
|
|
||||||
|
|
|
@ -697,7 +697,7 @@ static int parse_script_line(struct fdisk_script *dp, char *s)
|
||||||
script_get_label(dp), type);
|
script_get_label(dp), type);
|
||||||
free(type);
|
free(type);
|
||||||
|
|
||||||
if (!pa->type || fdisk_parttype_is_unknown(pa->type)) {
|
if (!pa->type) {
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
fdisk_unref_parttype(pa->type);
|
fdisk_unref_parttype(pa->type);
|
||||||
pa->type = NULL;
|
pa->type = NULL;
|
||||||
|
@ -843,7 +843,7 @@ static int parse_commas_line(struct fdisk_script *dp, char *s)
|
||||||
script_get_label(dp), str);
|
script_get_label(dp), str);
|
||||||
free(str);
|
free(str);
|
||||||
|
|
||||||
if (!pa->type || fdisk_parttype_is_unknown(pa->type)) {
|
if (!pa->type) {
|
||||||
rc = -EINVAL;
|
rc = -EINVAL;
|
||||||
fdisk_unref_parttype(pa->type);
|
fdisk_unref_parttype(pa->type);
|
||||||
pa->type = NULL;
|
pa->type = NULL;
|
||||||
|
|
Loading…
Reference in New Issue