[vdr] get a segmentation fault when starting vdr (backtrace included)
Dieter Bloms
vdr at bloms.de
Fri Nov 30 11:00:52 CET 2012
Hi Lars,
thank you for the help!
On Fri, Nov 30, Lars Hanisch wrote:
> 32: bool tComponent::FromString(const char *s)
> 33: {
> 34: unsigned int Stream, Type;
> 35: int n = sscanf(s, "%X %02X %7s %a[^\n]", &Stream, &Type, language, &description); // 7 = MAXLANGCODE2 - 1
> 36: if (n != 4 || isempty(description)) {
> 37: free(description);
> 38: description = NULL;
> 39: }
> 40: stream = Stream;
> 41: type = Type;
> 42: return n >= 3;
> 43: }
>
> What I would do:
> - set description to NULL before the sscanf
> - log all values returned by sscanf and compare it with the given string
I changed it this way:
--snip--
32 bool tComponent::FromString(const char *s)
33 {
34 unsigned int Stream, Type;
35 description = NULL;
36 int n = sscanf(s, "%X %02X %7s %a[^\n]", &Stream, &Type, language, &description); // 7 = MAXLANGCODE2 - 1
37 esyslog("dbloms: \"%X\" \"%02X\" \"%7s\" \"%a\"", Stream, Type, language, description);
38
39 if (n != 4 || isempty(description)) {
40 free(description);
41 description = NULL;
42 }
43 stream = Stream;
44 type = Type;
45 return n >= 3;
46 }
--snip--
but during compile I saw this message:
--snip--
g++ -g -O3 -Wall -Werror=overloaded-virtual -Wno-parentheses -c -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DVDR_USER=\"root\" -DLIRC_DEVICE=\"/var/run/lirc/lircd\" -D_GNU_SOURCE -DVIDEODIR=\"/remote/vdr/video\" -DCONFDIR=\"/etc/vdr/config\" -DCACHEDIR=\"\" -DRESDIR=\"\" -DPLUGINDIR=\"/usr/src/vdr-1.7.32/PLUGINS/lib\" -DLOCDIR=\"/usr/share/vdr/locale\" -I/usr/include/freetype2 -I/usr/src/v4l-dvb/linux/include epg.c
epg.c: In member function 'bool tComponent::FromString(const char*)':
epg.c:37:3: warning: format '%a' expects argument of type 'double', but argument 6 has type 'char*' [-Wformat]
--snip--
And after start in the logfile
--snip--
Nov 30 09:48:05 vdrservernew local1.err vdr: [4094] dbloms: "1" "01" " deu" "0x8.799b08p-1052"
--snip--
I think %a in my esyslog call isn't correct, but it is used this way
with the sscanf call and when I changed it with %s I don't see any log
entry.
So how should the esyslog call look like ?
--
Regards
Dieter
--
I do not get viruses because I do not use MS software.
If you use Outlook then please do not put my email address in your
address-book so that WHEN you get a virus it won't use my address in the
>From field.
More information about the vdr
mailing list