ikshwak / iperf

Automatically exported from code.google.com/p/iperf
Other
0 stars 0 forks source link

Don't assume unsigned char. getopt_long returns int not char #92

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In src/iperf_api.c iperf_parse_arguments():

Define ch as int not as char. Type char is an unsigned type on ARM 
architectures. If you assign the return value of getopt_long() to a char type, 
it'll convert -1 to 255 which will never compare equal to -1.

((ch = getopt_long(argc, argv, "p:f:i:DVJdvsc:ub:t:n:l:P:Rw:B:M:N6S:Zh", 
longopts, NULL)) != -1)

will be always true because ch is unsigned and therefore never equal to -1.

Original issue reported on code.google.com by danielme...@google.com on 2 Oct 2013 at 2:48

GoogleCodeExporter commented 8 years ago
I meant to say "Don't assume signed char".

Original comment by danielme...@google.com on 2 Oct 2013 at 2:49

GoogleCodeExporter commented 8 years ago
This is fixed in the current version.

Original comment by jef.posk...@gmail.com on 2 Oct 2013 at 3:46