env-util: add unsetenv_erase() helper

Let's unify how we remove secrets from the env block.
This commit is contained in:
Lennart Poettering
2021-08-17 13:17:44 +02:00
parent 8b474a437c
commit 7a6abbe937
8 changed files with 77 additions and 18 deletions
+2 -3
View File
@@ -2,6 +2,7 @@
#include "ask-password-api.h"
#include "cryptsetup-fido2.h"
#include "env-util.h"
#include "fileio.h"
#include "hexdecoct.h"
#include "json.h"
@@ -70,9 +71,7 @@ int acquire_fido2_key(
if (!pins)
return log_oom();
string_erase(e);
if (unsetenv("PIN") < 0)
return log_error_errno(errno, "Failed to unset $PIN: %m");
assert_se(unsetenv_erase("PIN") >= 0);
}
for (;;) {