freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Paul Andrews <andrewsp AT andronics.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Segmentation fault on dbinit()
- Date: Thu, 25 Oct 2007 15:55:31 +0100
Thanks Entropy.
I left out a rather crucial piece of information: the code AS IS
compiles, debugs, and runs fine on another Suse 10.2 machine.
I know it must be something to do with the FreeTDS configuration or
environment variables or something...!?!?
I just don't know how to fix it.
The line that is failing is
in = fopen(FREETDS_LOCALESCONFFILE, "+r");
in the tds_get_locale() function.
The environment variable FREETDS_LOCALESCONFFILE must be NULL (I imagine).
locales.conf is in /etc as is freetds.conf (which is evidently found
because tsql works).
Any ideas?
Paul.
entropy AT freetds.org wrote:
> Paul Andrews wrote:
>
>> Hi All.
>>
>> Getting a segmentation fault on dbinit().
>>
>> Platform: Suse 10.2 / 10.3 using rpm's from OpenSuse.org
>>
>> Tsql works fine.
>>
>> Using GDB, it looks like fopen on the locales.conf file in
>> tds_get_locale is failing.
>>
>> int db_connect(int nDbType, char acServer[], char acUsername[], char
>> acPassword[], char acAppName[], char acDatabase[], char acFreeTdsDbName[])
>> {
>> [...]
>>
>> //dberrhandle((EHANDLEFUNC)dberr_handler);
>> //dbmsghandle((MHANDLEFUNC)dbmsg_handler);
>>
>> if ( dbinit() == FAIL ) ==> Segmentation Fault here
>>
>
> Is your db_connect() function called more than once per run?
>
> dbinit() must be called exactly once per application, and must be called
> before any other DB-Lib function.
>
> Move it to the beginning of main() or some other suitable initialization
> point for your application, and move the dberrhandle() and dbmsghandle()
> calls after it (if you plan to uncomment them at some point).
>
> If you must call it from this function, then use a static variable to
> ensure it is done only once, and make sure no other DB-Lib calls can
> happen beforehand elsewhere in the app.
>
>
-
[freetds] Segmentation fault on dbinit(),
Paul Andrews, 10/25/2007
-
Re: [freetds] Segmentation fault on dbinit(),
entropy, 10/25/2007
-
Re: [freetds] Segmentation fault on dbinit(),
Paul Andrews, 10/25/2007
- Re: [freetds] Segmentation fault on dbinit(), James K. Lowden, 10/25/2007
-
Re: [freetds] Segmentation fault on dbinit(),
Paul Andrews, 10/25/2007
- <Possible follow-up(s)>
-
Re: [freetds] Segmentation fault on dbinit(),
Paul Andrews, 10/25/2007
-
Re: [freetds] Segmentation fault on dbinit(),
James K. Lowden, 10/25/2007
- Re: [freetds] Segmentation fault on dbinit(), Paul Andrews, 10/25/2007
-
Re: [freetds] Segmentation fault on dbinit(),
Paul Andrews, 10/26/2007
-
Re: [freetds] Segmentation fault on dbinit(),
Paul Andrews, 10/26/2007
-
Re: [freetds] Segmentation fault on dbinit(),
Konrad J Hambrick, 10/26/2007
- Re: [freetds] Segmentation fault on dbinit(), Paul Andrews, 10/26/2007
-
Re: [freetds] Segmentation fault on dbinit(),
Konrad J Hambrick, 10/26/2007
- Re: [freetds] Segmentation fault on dbinit(), James K. Lowden, 10/26/2007
-
Re: [freetds] Segmentation fault on dbinit(),
Paul Andrews, 10/26/2007
-
Re: [freetds] Segmentation fault on dbinit(),
James K. Lowden, 10/25/2007
-
Re: [freetds] Segmentation fault on dbinit(),
entropy, 10/25/2007
Archive powered by MHonArc 2.6.24.