From c34dfb6570cbe28cff2b4c3e73591472e8dd06ce Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 20 Aug 2024 19:28:53 +0400 Subject: [PATCH] fix: don't ignore error on partition delete There is subtle issue with return code 'EBUSY' while myEntry is nil, which might not fall through into this code to report an error correctly. Signed-off-by: Andrey Smirnov --- partitioning/gpt/gpt.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/partitioning/gpt/gpt.go b/partitioning/gpt/gpt.go index e1e8596..a1f2fcf 100644 --- a/partitioning/gpt/gpt.go +++ b/partitioning/gpt/gpt.go @@ -630,8 +630,10 @@ func (t *Table) syncKernel() error { } continue - case err != nil: - return fmt.Errorf("failed to delete partition %d: %w", no, err) + default: + if err != nil { + return fmt.Errorf("failed to delete partition %d: %w", no, err) + } } err = t.dev.KernelPartitionAdd(no,