libftdi-git Archives

Subject: A library to talk to FTDI chips branch, master, updated. v1.5-5-g45ebed3

From: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
To: libftdi-git@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 24 Aug 2020 19:45:55 +0200 (CEST)
The branch, master has been updated
       via  45ebed3754aa2814583f4d433155f87f24f5351f (commit)
      from  11a50ae5b80b3e03694a19e84513345d0794e563 (commit)


- Log -----------------------------------------------------------------
commit 45ebed3754aa2814583f4d433155f87f24f5351f
Author: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Date:   Mon Aug 24 19:45:41 2020 +0200

    examples/bitbang_cbus.c: Check return value of fgets()

-----------------------------------------------------------------------

Summary of changes:
 examples/bitbang_cbus.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/examples/bitbang_cbus.c b/examples/bitbang_cbus.c
index b902b50..359097e 100644
--- a/examples/bitbang_cbus.c
+++ b/examples/bitbang_cbus.c
@@ -60,8 +60,9 @@ int main(void)
     while (1)
     {
         // Set bitmask from input
-        fgets(input, sizeof(input) - 1, stdin);
-        if (input[0] == '\n') break;
+        char *s = fgets(input, sizeof(input) - 1, stdin);
+        if (s == NULL || input[0] == '\n')
+            break;
         bitmask = strtol(input, NULL, 0);
         printf("Using bitmask 0x%02x\n", bitmask);
         f = ftdi_set_bitmode(ftdi, bitmask, BITMODE_CBUS);


hooks/post-receive
-- 
A library to talk to FTDI chips

--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread
  • A library to talk to FTDI chips branch, master, updated. v1.5-5-g45ebed3, libftdi-git <=