Use s_write to print totp

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët 2020-10-28 07:52:56 +00:00
parent 8f4ad7cd30
commit 387cb2ddba

View file

@ -521,8 +521,9 @@ totp(const char *secret, size_t len)
uint32_t ret = (load32_be(&h[h[19] & 0xF]) & ~(UINT32_C(1) << 31))
% UINT32_C(1000000);
printf("%06" PRIu32, ret);
char tmp[7];
if (snprintf(tmp, sizeof(tmp), "%06" PRIu32, ret) == 6)
s_write(1, tmp, 6);
}
static int