return rc;
}
-struct fdisk_parttype *ask_partition_type(struct fdisk_context *cxt)
+static struct fdisk_parttype *ask_partition_type(struct fdisk_context *cxt)
{
const char *q;
struct fdisk_label *lb;
i + 1, old);
fdisk_unref_partition(pa);
+ fdisk_unref_parttype(t);
}
int print_partition_info(struct fdisk_context *cxt)
extern void list_partition_types(struct fdisk_context *cxt);
extern void change_partition_type(struct fdisk_context *cxt);
-extern struct fdisk_parttype *ask_partition_type(struct fdisk_context *cxt);
extern void toggle_dos_compatibility_flag(struct fdisk_context *cxt);
const struct fdisk_label *lb,
const char *str)
{
- struct fdisk_parttype *types, *ret;
- unsigned int code = 0;
- char *typestr = NULL, *end = NULL;
+ struct fdisk_parttype *types, *ret = NULL;
+ char *end = NULL;
assert(lb);
types = lb->parttypes;
if (types[0].typestr == NULL && isxdigit(*str)) {
+ unsigned int code = 0;
errno = 0;
code = strtol(str, &end, 16);
ret = fdisk_label_get_parttype_from_code(lb, code);
if (ret)
goto done;
+
+ ret = fdisk_new_unknown_parttype(code, NULL);
} else {
int i;
ret = &types[i - 1];
goto done;
}
+
+ ret = fdisk_new_unknown_parttype(0, str);
}
- ret = fdisk_new_unknown_parttype(code, typestr);
done:
- DBG(PARTTYPE, ul_debugobj(ret, "returns parsed '%s' partition type", ret->name));
+ DBG(PARTTYPE, ul_debugobj(ret, "returns parsed '%s' [%s] partition type",
+ ret->name, ret->typestr ? : ""));
return ret;
}