From: Christian M. <ma...@ma...> - 2007-09-30 18:53:47
|
The main problem is in ow_opt.c: int owopt_packed(const char *params) Where getopt_long() is called with first object in OWSources (192.168.0.22:3002) first time... and second time getopt_long() is = called with second object in OWSources (u0). Getopt() are not meant to be used like that... (eg change the argument list), but this is what happens here. Argc and argv is normally not changing. Paul, Do you know if it's possible to reset the state of the getopt() functions? I tried to add this initialization before the while-loop, but it didn't help.. optarg =3D NULL; optind =3D 0; opterr =3D 1; optopt =3D '?'; /Christian > -----Original Message----- > From: owf...@li... [mailto:owfs-cvs- > bo...@li...] On Behalf Of Thomas Gr=FCnberg > Sent: den 30 september 2007 16:16 > To: owf...@li... > Subject: [Owfs-cvs] Using OW.pm in a loop fails with : Compilation > segmentation fault >=20 > Hi everybody, >=20 > I try to get data from different OW sources (tty, usb, and a NSLUG > running > owserver) using the perl module 0W.pm (version from owfs-2.6p6) >=20 > If I use OW.pm to select one of the ow-sources, everything works fine. >=20 > But if I use: >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D snip = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > foreach my $OWSource (@OWSources) > {OW::init($OWSource); > $log->debug("OWInit von OWSource =3D> $OWSource"); >=20 > my $BusData =3D OW::get("/") or return ; > $log->debug("Busdaten: $BusData"); >=20 > OW::finish(); > $log->debug(" OWFinish "); > sleep 2; > } > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D snap = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > I get: Compilation segmentation fault >=20 > and in the log-file: >=20 > 2007/09/30 16:03:10 DEBUG> segfaulttest.pl:151 main:: - OWFS-Sources = =3D> > 192.168.0.22:3002 u0 > 2007/09/30 16:03:10 DEBUG> segfaulttest.pl:168 main:: - OWInit von > OWSource =3D> > 192.168.0.22:3002 > 2007/09/30 16:03:11 DEBUG> segfaulttest.pl:171 main:: - Busdaten: > = structure/,bus.0/,uncached/,settings/,system/,statistics/,10.CCFD240108 > = 00/,10.A20425010800/,10.019125010800/,10.717A25010800/,10.E99225010800/ > = ,10.E78925010800/,10.177125010800/,10.77FE24010800/,10.8FB950000800/,10 > .1F232C000800/,10.5F2525010800/,81.D64928000000/,alarm/,simultaneous/ > 2007/09/30 16:03:11 DEBUG> segfaulttest.pl:175 main:: - OWFinish > 2007/09/30 16:03:13 DEBUG> segfaulttest.pl:168 main:: - OWInit von > OWSource =3D> > u0 >=20 > So it crashes when it tries to initialise OW::init($OWSource) with the > second > ow-source. >=20 > Did I misunderstand the use ow OW.pm ? Is it possible to give OW.pm a > list of > sources to initialise ? (tried it, but no avail) >=20 > Help very welcome ! > Thomas >=20 >=20 > = ----------------------------------------------------------------------- > -- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Owfs-cvs mailing list > Owf...@li... > https://lists.sourceforge.net/lists/listinfo/owfs-cvs |