Skip to Content.
Sympa Menu

freetds - Re: [freetds] Segmentation fault on dbinit()

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Segmentation fault on dbinit()
  • Date: Thu, 25 Oct 2007 11:32:42 -0400

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
> imagine).

#define FREETDS_LOCALECONFFILE FREETDS_SYSCONFDIR TDS_SDIR_SEPARATOR
#"locales.conf"

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
compiled-in defaults.

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,
not crash.

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
standard library.

HTH.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page