[freetds] Segmentation fault on dbinit()
James K. Lowden
jklowden at freetds.org
Thu Oct 25 11:32:42 EDT 2007
Paul Andrews wrote:
> I left out a rather crucial piece of information: the code AS IS
> compiles, debugs, and runs fine on another Suse 10.2 machine.
For the record, it's easy for something to be slightly different.
> 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
#define FREETDS_LOCALECONFFILE FREETDS_SYSCONFDIR TDS_SDIR_SEPARATOR
It's not an environment variable.
> locales.conf is in /etc as is freetds.conf (which is evidently found
> because tsql works).
And FreeTDS tolerates a missing locale.conf. Without one, it uses its
I would try setting TDSDUMP and looking at the log. It will tell you if
dbinit() is being called more than once. If it is, you then have enough
information to fix your program, including entropy's good advice.
All segmentation faults are bugs, however. If you determine that you are
calling dbinit() more than once, and it's causing a segmentation fault,
please post a message here, and I'll look into it. It should only FAIL,
That said, if the program really crashes inside fopen(3), I don't know
what to tell you. It's being passed two compiled-in values, and in any
case it's impossible, or should be, to induce a segmentation fault by
calling fopen(3), no matter what parameters are passed.
In your shoes, I'd be much more inclined to doubt myself than the C
More information about the FreeTDS