Skip to content

Commit 72dcb69

Browse files
aafeijoo-susebluca
authored andcommitted
cryptenroll: show better log message if slot to wipe does not exist
``` $ systemd-cryptenroll /dev/vda3 SLOT TYPE 0 password $ systemd-cryptenroll --wipe-slot 1 /dev/vda3 Failed to wipe slot 1, continuing: No such file or directory ``` (cherry picked from commit 2b25149) (cherry picked from commit 4a3d55a) (cherry picked from commit ade617c) (cherry picked from commit b265ca1) (cherry picked from commit b2f6a12)
1 parent 2841e6e commit 72dcb69

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cryptenroll/cryptenroll-wipe.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,10 @@ int wipe_slots(struct crypt_device *cd,
425425
for (size_t i = n_ordered_slots; i > 0; i--) {
426426
r = crypt_keyslot_destroy(cd, ordered_slots[i - 1]);
427427
if (r < 0) {
428-
log_warning_errno(r, "Failed to wipe slot %i, continuing: %m", ordered_slots[i - 1]);
428+
if (r == -ENOENT)
429+
log_warning_errno(r, "Failed to wipe non-existent slot %i, continuing.", ordered_slots[i - 1]);
430+
else
431+
log_warning_errno(r, "Failed to wipe slot %i, continuing: %m", ordered_slots[i - 1]);
429432
if (ret == 0)
430433
ret = r;
431434
} else

0 commit comments

Comments
 (0)