Update the pair_ap library. Thanks again to ejurgensen for this code.

This commit is contained in:
Mike Brady
2022-09-26 17:24:04 +01:00
parent 0c8b2200f7
commit 0f476da0ee
6 changed files with 38 additions and 41 deletions
+7 -4
View File
@@ -45,18 +45,21 @@ static char *
prompt_pin(void)
{
char *pin = NULL;
size_t len;
ssize_t len;
size_t sz;
printf ("Enter pin: ");
fflush (stdout);
len = getline(&pin, &len, stdin);
if (len != 5) // Includes EOL
len = getline(&pin, &sz, stdin);
if (len < 1)
{
printf ("Bad pin length %zu\n", len);
printf("Bad pin entered (len=%zd)\n", len);
return NULL;
}
pin[len - 1] = '\0'; // Zero the EOL
return pin;
}