summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/fdisk/cmd.c28
-rw-r--r--sbin/fdisk/part.c4
2 files changed, 13 insertions, 19 deletions
diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c
index 4a263772787..ffeb1d0cdfb 100644
--- a/sbin/fdisk/cmd.c
+++ b/sbin/fdisk/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.170 2023/03/26 16:23:58 krw Exp $ */
+/* $OpenBSD: cmd.c,v 1.171 2023/03/29 14:20:50 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -594,24 +594,18 @@ ask_uuid(const struct uuid *olduuid)
char lbuf[LINEBUFSZ];
char *dflt = NULL;
uint32_t status;
- int num = 0;
-
- uuid = *olduuid;
- if (uuid_is_nil(&uuid, NULL) == 0) {
- num = PRT_uuid_to_type(&uuid);
- if (num == 0) {
- uuid_to_string(&uuid, &dflt, &status);
- if (status != uuid_s_ok) {
- printf("uuid_to_string() failed\n");
- goto done;
- }
- }
- }
- if (dflt == NULL) {
- if (asprintf(&dflt, "%X", num) == -1) {
- warn("asprintf()");
+ int num;
+
+ num = PRT_uuid_to_type(olduuid);
+ if (num == -1) {
+ uuid_to_string(olduuid, &dflt, &status);
+ if (status != uuid_s_ok) {
+ printf("uuid_to_string() failed\n");
goto done;
}
+ } else if (asprintf(&dflt, "%X", num) == -1) {
+ warn("asprintf()");
+ goto done;
}
for (;;) {
diff --git a/sbin/fdisk/part.c b/sbin/fdisk/part.c
index 03702bed66a..3597e326fb8 100644
--- a/sbin/fdisk/part.c
+++ b/sbin/fdisk/part.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: part.c,v 1.139 2023/03/26 16:23:58 krw Exp $ */
+/* $OpenBSD: part.c,v 1.140 2023/03/29 14:20:50 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -527,7 +527,7 @@ PRT_uuid_to_type(const struct uuid *uuid)
gt = find_gpt_type(uuid);
if (gt == NULL)
- return 0;
+ return -1;
else
return gt->gt_type;
}