diff mbox series

[bug#53063,v2,wip-harden-installer,10/18] installer: Raise condition when mklabel fails.

Message ID 20220115135011.5817-11-dev@jpoiret.xyz
State Accepted
Headers show
Series General improvements to the installer | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Josselin Poiret Jan. 15, 2022, 1:50 p.m. UTC
* gnu/installer/parted.scm (mklabel): Do it.
---
 gnu/installer/parted.scm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index c8bb73ee64..e33ef5f8fd 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -635,8 +635,14 @@  (define (user-partition-description user-partition)
 (define (mklabel device type-name)
   "Create a partition table on DEVICE. TYPE-NAME is the type of the partition
 table, \"msdos\" or \"gpt\"."
-  (let ((type (disk-type-get type-name)))
-    (disk-new-fresh device type)))
+  (let* ((type (disk-type-get type-name))
+         (disk (disk-new-fresh device type)))
+    (or disk
+        (raise
+         (condition
+          (&error)
+          (&message (message (format #f "Cannot create partition table of type
+~a on device ~a." type-name (device-path device)))))))))
 
 
 ;;