diff options
author | Antonio Alvarez Feijoo <antonio.feijoo@suse.com> | 2024-11-19 11:26:49 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2024-11-19 12:00:50 +0100 |
commit | 2b251491debf9cab695f5f34da9908ca46f085fe (patch) | |
tree | 52022c8b9e71b69d9d7043321f489724844c6b49 /src | |
parent | update TODO (diff) | |
download | systemd-2b251491debf9cab695f5f34da9908ca46f085fe.tar.xz systemd-2b251491debf9cab695f5f34da9908ca46f085fe.zip |
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
```
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptenroll/cryptenroll-wipe.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cryptenroll/cryptenroll-wipe.c b/src/cryptenroll/cryptenroll-wipe.c index 703342f758..67c3795d34 100644 --- a/src/cryptenroll/cryptenroll-wipe.c +++ b/src/cryptenroll/cryptenroll-wipe.c @@ -427,7 +427,10 @@ int wipe_slots(struct crypt_device *cd, for (size_t i = n_ordered_slots; i > 0; i--) { r = crypt_keyslot_destroy(cd, ordered_slots[i - 1]); if (r < 0) { - log_warning_errno(r, "Failed to wipe slot %i, continuing: %m", ordered_slots[i - 1]); + if (r == -ENOENT) + log_warning_errno(r, "Failed to wipe non-existent slot %i, continuing.", ordered_slots[i - 1]); + else + log_warning_errno(r, "Failed to wipe slot %i, continuing: %m", ordered_slots[i - 1]); if (ret == 0) ret = r; } else |