Open GoogleCodeExporter opened 8 years ago
Hi!
I think the issue is due to incorrect usage of the basename function. The
program name (argv[0]) has to be duplicated before sent as argument to the
basename function because basename may modify the contents of the path argument.
I've just started using this software with my weather station and I don't know
how to contribute with fixes and patches but the following change solved the
segmentation fault problem:
Change the line wmr.c:387
fbname = (char *) basename( (char **) argv[0]);
to something like this
char *path = strdup((const char*)argv[0]);
fbname = (char *) basename(path);
/Andrei
Original comment by andrei.p...@gmail.com
on 7 Jan 2014 at 8:48
After some more investigation this seems to be a build issue.
According to the libc manual this is correct if the GNU version of the function
basename is used (with some portability issues):
char *prog = basename (argv[0]);
However, for some reason the standard XPG defined basename function is linked
instead on my system, and it's probably because _GNU_SOURCE is not defined
(outcommented on wmr.c:16).
Original comment by andrei.p...@gmail.com
on 7 Jan 2014 at 9:23
Original issue reported on code.google.com by
radomir....@gmail.com
on 6 Nov 2013 at 7:43