summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-03-20 10:29:20 +0100
committerLennart Poettering <lennart@poettering.net>2019-03-20 10:48:33 +0100
commite1ed99c8c89d6e4ca4df3e47617ff1f3e194cabb (patch)
treed01ff5dcd5ead9109962b7a0f81e1f942e27bfa8 /src/shared
parentd5d1ae153f394aa08e436a747d20702b18e79f00 (diff)
downloadsystemd-e1ed99c8c89d6e4ca4df3e47617ff1f3e194cabb.tar.gz
ask-password: erase character read with _cleanup_
This is much nicer, since it means we erase the character regardless how we exit the scope.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/ask-password-api.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c
index 4122362b3c..88335c6d08 100644
--- a/src/shared/ask-password-api.c
+++ b/src/shared/ask-password-api.c
@@ -306,9 +306,9 @@ int ask_password_tty(
};
for (;;) {
+ _cleanup_(erase_char) char c;
int sleep_for = -1, k;
ssize_t n;
- char c;
if (until > 0) {
usec_t y;
@@ -452,9 +452,6 @@ int ask_password_tty(
dirty = true;
}
-
- /* Let's forget this char, just to not keep needlessly copies of key material around */
- c = 'x';
}
x = strndup(passphrase, p);