summaryrefslogtreecommitdiff
diff options
authorMichael Vogt <mvo@ubuntu.com>2023-07-03 11:56:12 +0200
committerMichael Vogt <michael.vogt@gmail.com>2023-07-06 18:02:10 +0200
commit838b5f868cb964beb68ae353bb21bee6754e0dd5 (patch)
tree6ec4fd66192b2ce48663125265d1d584a75b301a
parent4f49d3673e7874b86bfd20a00a3ec381489fa945 (diff)
luks2: fix error reporting when fifoErr is nil
-rw-r--r--secboot/luks2/cryptsetup.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/secboot/luks2/cryptsetup.go b/secboot/luks2/cryptsetup.go
index 0bb411e569..b8c841c192 100644
--- a/secboot/luks2/cryptsetup.go
+++ b/secboot/luks2/cryptsetup.go
@@ -203,7 +203,7 @@ func AddKey(devicePath string, existingKey, key []byte, options *AddKeyOptions)
fifoErr := <-fifoErrCh
switch {
- case cmdErr != nil && errors.Is(fifoErr, syscall.EPIPE):
+ case cmdErr != nil && (fifoErr == nil || errors.Is(fifoErr, syscall.EPIPE)):
// cmdErr and EPIPE means the problem is with cmd, no
// need to display the EPIPE error
return fmt.Errorf("cryptsetup failed with: %v", osutil.OutputErr(output, err))