[rrd-users] Re: rrd_fetch Segmentation Fault - getopts

Francois Mikus francois.mikus at transcontinental.ca
Mon Jul 8 20:55:40 MEST 2002


Hello,

RE: optind=0;

It is indeed reset at the start of the function HandleInputLine. Which
did confuse me a little bit, but I figure that something was being
called in the intermediate code between the initialisation and the call
to rrd_fetch that would use getopt. Which would eventually cause
rrd_fetch to start processing with an erronous value of optind.

The line I am using to call rrd tool is the following, interpreted by
Perl 5.6.0 standard with Red Hat 7.2.

my ($start,$step,$names,$data) = RRDs::fetch ($targetdata, $cf,
"--start", $startval);

Where cf is AVERAGE for a a few hundred iterations and then MAX. 
Start value is always either, -1day, -5days, -1month, 6months.

The use of the --start argument causes getopt to be used. According to
previous list postings, it is only in the case of using the --arguments
that a segfault could be caused. Without them, it should not segfault,
which is probably because it doesn't call getopt.

What I will insert a debug message in rrd_tool.c to print out the value
of optind before calling rrd_fetch. 
I will also remove my addition of the optind=0 and opterr=0 at line 512.

Then we shall see if it changed!

In theory I could do a dump of the code executed before the crash, but
it has been so long since I have spent any time on c debugging that I
fear it would probably spend too much time on it.. I don't really
remember how to do it. ;-)

Francois Mikus


> >
> 
> Francois,
> 
> Can you shed any light on you optind should be reset again 
> when it gets reset at the beginning of the function ?
> 
> does it get overwritten ?
> 
> confused
> tobi

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list