[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fix to my SEGFAULTs on redhat 7.2
From: |
Mark . Burgess |
Subject: |
Re: fix to my SEGFAULTs on redhat 7.2 |
Date: |
Sun, 16 Jun 2002 17:24:58 +0200 (MET DST) |
> Anyway, the problem seems to be with the global variable
> 'DESTINATION'.
> My crash was occuring in the AbsLinkPath() call in the
> LinkFiles() routine. Evidentally the DESTINATION variable
> is used as a place to hold stuff w/o having to setup
> and the free the space all the time, at least that is what this
> comment leads me to think:
>
> strcpy(DESTINATION,from); /* reuse to save stack space */
>
> certainly know nothing about pthreads, I just added the following
> lines in link.c:
>
> diff -r1.1 link.c
> 1179a1180,1182
>>
>> DESTINATION = (char *) malloc(bufsize);
>> bzero(DESTINATION,bufsize);
>
> Presto chango, no more core dumps. However, I'm pretty sure
> the malloc should be done somewhere more global since
> DESTINATION is used in other places. And probably the
> routines in parse.c shouldn't be doing stuff with
> DESTINATION since it is a global.
DESTINATION is meant to be used in parse, not elsewhere. This
is a hangover from version 1, where some globals were reused,
to save space. A better solution is to allocate new static space
locally to this function.
thanks for finding the problem,
Mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272 Email: address@hidden
Fax : +47 22453205 WWW : http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~