daemon examples: avaid compile warning

This commit is contained in:
Matthias Ringwald 2018-11-08 08:21:57 +01:00
parent 04e44aa625
commit cb93c223bc
2 changed files with 6 additions and 2 deletions

View File

@ -136,7 +136,9 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
case HCI_EVENT_PIN_CODE_REQUEST:
// inform about pin code request
printf("Please enter PIN here: ");
fgets(pin, 20, stdin);
// avoid -Wunused-result
char* res = fgets(pin, 20, stdin);
UNUSED(res);
i = strlen(pin)-1;
if( pin[i] == '\n') {
pin[i] = '\0';

View File

@ -150,7 +150,9 @@ void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint
case HCI_EVENT_PIN_CODE_REQUEST:
// inform about pin code request
printf("Please enter PIN here: ");
fgets(pin, 20, stdin);
// avoid -Wunused-result
char* res = fgets(pin, 20, stdin);
UNUSED(res);
i = strlen(pin);
if( pin[i-1] == '\n' || pin[i-1] == '\r') {
pin[i-1] = '\0';