xebd / accel-ppp

High performance PPTP/L2TP/PPPoE/IPoE server for Linux
GNU General Public License v2.0
296 stars 108 forks source link

Fix accel-cmd compile problem on Raspbian Buster #124

Closed hardillb closed 4 years ago

hardillb commented 4 years ago

With GCC v8.x on Raspbian Buster the following warning is shown at compile time:

... [ 99%] Building C object accel-cmd/CMakeFiles/accel-cmd.dir/accel_cmd.c.o /home/pi/accel-ppp/accel-cmd/accel_cmd.c: In function ‘main’: /home/pi/accel-ppp/accel-cmd/accel_cmd.c:652:29: warning: comparison is always true due to limited range of data type [-Wtype-limits] long_opts, &oindx)) != -1) { ^~ [100%] Linking C executable accel-cmd [100%] Built target accel-cmd

This leads to the accel-cmd always just showing the usage instructions rather than executing any commands.

This is because ochar is declared as a char rather than an int so is considered to be unsigned by default. The man page says the return value should be an int.

https://linux.die.net/man/3/getopt_long