if (buf[1] == '\0' && toupper(*buf) == 'L')
list_partition_types(cxt);
- else if (*buf)
- return fdisk_label_parse_parttype(lb, buf);
+ else if (*buf) {
+ struct fdisk_parttype *t = fdisk_label_parse_parttype(lb, buf);
+
+ if (!t)
+ fdisk_info(cxt, _("Failed to parse '%s' partition type."), buf);
+ return t;
+ }
} while (1);
return NULL;
break;
} while (!t);
- if (canceled == 0 && fdisk_set_partition_type(cxt, i, t) == 0)
+ if (canceled == 0 && t && fdisk_set_partition_type(cxt, i, t) == 0)
fdisk_info(cxt,
_("Changed type of partition '%s' to '%s'."),
old, t ? fdisk_parttype_get_name(t) : _("Unknown"));
str, lb->name));
types = lb->parttypes;
- if (types[0].typestr == NULL && isxdigit(*str)) {
+ if (types[0].typestr == NULL) {
unsigned int code = 0;
+ DBG(LABEL, ul_debugobj(lb, " parsing hex"));
+
errno = 0;
code = strtol(str, &end, 16);
} else {
int i;
+ DBG(LABEL, ul_debugobj(lb, " parsing string"));
+
/* maybe specified by type string (e.g. UUID) */
ret = fdisk_label_get_parttype_from_string(lb, str);
if (ret)