[PATCH] Allow override of the dotfile location

Andreas Köhler andi5.py at gmx.net
Wed Mar 21 18:56:22 EDT 2007


Hi,

Am Mittwoch, den 21.03.2007, 21:22 +0000 schrieb James Radley:
> Hmm. After a quick read of the glib docs, I'd agree with you about the 
> $HOME variable, which is a fallback if glib can't work out the home 
> directory from /etc/passwd or similar. I've amended the patch slightly 
> below, to use g_getenv() as you suggest, and to g_strdup() the result 
> before assigning to dotgnucash. This should have the double effect of
> 
> a) Having a string that's safe to g_free() -- though I'm not sure it 
> will be, as dotgnucash is a static variable. Better to be safe though.
> b) Having a string that won't mutate next time someone calls 
> g_[get|set|unset]env()

thanks for the revisited patch.  r15746 is your number :-)

b) is indeed important.

> Christian Stimming wrote:
> > @James: The patch looks fine, except that you should use g_getenv instead of 
> > getenv (and IIRC there were some reversed semantics when changing from one 
> > such call to the other).
[snip]

I guess you mean setenv vs. g_setenv:

The setenv() function returns zero on success, or [...]
g_setenv: Returns: FALSE if the environment variable couldn't be set.

-- andi5




More information about the gnucash-devel mailing list