jkorell/iperf

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

Closed this issue · 2 comments

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

I meant to say "Don't assume signed char".

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

This is fixed in the current version.

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

  • Changed state: Fixed