Closed wjungle closed 8 years ago
Same happens to me when no command line arguments are provided. I may have time to work out a pull request so that the client application does a length check on the argument string and exits with no args provided.
Grabbed a coredump and looked at the backtrace. The offending line with a segfault is: Client/src/lib/mqttsnClientAppFw4Linux.cpp
No device name is provided but strdup tries to make a duplicate anyway. Won't happen if NETWORK_XBEE macro is undefined
If you compile with NETWORK_UDP defined and NETWORK_XBEE undefined and start the application with no arguments, it gives an "argument error" and no segmentation fault. I will try to match this behavior, if I have time to patch.
@wjungle Have you tried running TomyClient with the -d option?
Fix provided in Pull request #7
CC: @ty4tw
Hi: I compiled MQTT-SN/Clint followed the README, the code was build fine. But when I execute "TomyClient", it showed that "Segmentation fault (core dumped)". I used GDB to find the problem. Messages as following:
Program received signal SIGSEGV, Segmentation fault. strlen () at ../sysdeps/x86_64/strlen.S:106 106 ../sysdeps/x86_64/strlen.S: No such file or directory. (gdb) where
0 strlen () at ../sysdeps/x86_64/strlen.S:106
1 0x00007ffff758382e in __GI___strdup (s=0x0) at strdup.c:41
2 0x0000000000401b12 in MqttsnClientApplication::initialize(int, char**) ()
3 0x000000000040123d in main ()
Do I lack something?
Thanks
wjungle