summaryrefslogtreecommitdiff
path: root/accel-cmd
diff options
context:
space:
mode:
authorBen Hardill <b.hardill@gmail.com>2020-03-26 22:08:58 +0000
committerBen Hardill <b.hardill@gmail.com>2020-03-26 22:08:58 +0000
commite659a55b0e8a22d31a90e359d18807fbb8ef870e (patch)
tree5effd8fe181b1c31e73aa7a346167189fb2b236d /accel-cmd
parentc6496ef1bc9b305f7821f20183a8d99dc432950f (diff)
downloadaccel-ppp-e659a55b0e8a22d31a90e359d18807fbb8ef870e.tar.gz
accel-ppp-e659a55b0e8a22d31a90e359d18807fbb8ef870e.zip
Fix accel-cmd compile problem on Raspbian Buster
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
Diffstat (limited to 'accel-cmd')
-rw-r--r--accel-cmd/accel_cmd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/accel-cmd/accel_cmd.c b/accel-cmd/accel_cmd.c
index e0ca7d41..273a2dda 100644
--- a/accel-cmd/accel_cmd.c
+++ b/accel-cmd/accel_cmd.c
@@ -645,7 +645,7 @@ int main(int argc, char **argv)
bool numeric = false;
int inputstream = -1;
int oindx = 0;
- char ochar;
+ int ochar;
int rv;
while ((ochar = getopt_long(argc, argv, "f:46ni:H:p:t:P:vVh-",