The branch, master has been updated
       via  53a561d380532adfd73159760681d8f2f91e2895 (commit)
      from  6eb32553b11d97f4a25825229ee51fedd3f33ee8 (commit)


- Log -----------------------------------------------------------------
commit 53a561d380532adfd73159760681d8f2f91e2895
Author: Uwe Bonnes <[email protected]>
Date:   Mon Sep 5 11:39:30 2011 +0200

    examples/serial_test.c: Don't crash if no pattern on write is given
    
    Exit immediate if invalid write pattern is given

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

Summary of changes:
 examples/serial_test.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/examples/serial_test.c b/examples/serial_test.c
index 60c5a84..46599b8 100644
--- a/examples/serial_test.c
+++ b/examples/serial_test.c
@@ -34,7 +34,7 @@ int main(int argc, char **argv)
     int baudrate = 115200;
     int interface = INTERFACE_ANY;
     int do_write = 0;
-    unsigned int pattern;
+    unsigned int pattern = 0xffff;
     int retval = EXIT_FAILURE;
 
     while ((i = getopt(argc, argv, "i:v:p:b:w::")) != -1)
@@ -55,9 +55,13 @@ int main(int argc, char **argv)
                 break;
             case 'w':
                 do_write = 1;
-                pattern = strtoul(optarg, NULL, 0);
+                if (optarg)
+                    pattern = strtoul(optarg, NULL, 0);
                 if (pattern > 0xff)
+                {
                     fprintf(stderr, "Please provide a 8 bit pattern\n");
+                    exit(-1);
+                }
                 break;
             default:
                 fprintf(stderr, "usage: %s [-i interface] [-v vid] [-p pid] 
[-b baudrate] [-w [pattern]]\n", *argv);


hooks/post-receive
-- 
port libftdi to libusb-1.0

--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [email protected]   

Reply via email to