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:
Karel Zak 2015-01-28 09:57:03 +01:00
parent 9bd2906012
commit bf031d89ea
2 changed files with 4 additions and 4 deletions

View File

@ -715,9 +715,9 @@ static int command_parttype(struct sfdisk *sf, int argc, char **argv)
if (sf->backup)
backup_partition_table(sf, devname);
/* parse <type> and apply yo PT */
/* parse <type> and apply to PT */
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'"),
fdisk_label_get_name(lb), typestr);

View File

@ -697,7 +697,7 @@ static int parse_script_line(struct fdisk_script *dp, char *s)
script_get_label(dp), type);
free(type);
if (!pa->type || fdisk_parttype_is_unknown(pa->type)) {
if (!pa->type) {
rc = -EINVAL;
fdisk_unref_parttype(pa->type);
pa->type = NULL;
@ -843,7 +843,7 @@ static int parse_commas_line(struct fdisk_script *dp, char *s)
script_get_label(dp), str);
free(str);
if (!pa->type || fdisk_parttype_is_unknown(pa->type)) {
if (!pa->type) {
rc = -EINVAL;
fdisk_unref_parttype(pa->type);
pa->type = NULL;