Replace setenv() by g_setenv for increased cross-platform

compatibility.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13542 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2006-03-08 16:00:09 +00:00
parent 6ef3e79b63
commit 9bcdddbe43
3 changed files with 11 additions and 10 deletions

View File

@ -1,5 +1,12 @@
2006-03-08 Christian Stimming <stimming@tuhh.de> 2006-03-08 Christian Stimming <stimming@tuhh.de>
* src/gnc-module/gnc-module.c, src/backend/file/sixtp-utils.c:
Replace setenv() by g_setenv for increased cross-platform
compatibility.
* src/engine/gnc-filepath-utils.c: Replace mkdir by g_mkdir for
increased cross-platform compatibility.
* src/core-utils/gnc-gconf-utils.c, * src/core-utils/gnc-gconf-utils.c,
src/business/business-gnome/business-urls.c src/business/business-gnome/business-urls.c
src/gnome-utils/dialog-preferences.c src/gnome-utils/dialog-preferences.c

View File

@ -39,9 +39,6 @@
#include <errno.h> #include <errno.h>
#ifdef GNUCASH_MAJOR_VERSION #ifdef GNUCASH_MAJOR_VERSION
#ifndef HAVE_SETENV
#include "setenv.h"
#endif
#ifndef HAVE_STRPTIME #ifndef HAVE_STRPTIME
#include "strptime.h" #include "strptime.h"
#endif #endif
@ -394,19 +391,19 @@ gnc_timegm (struct tm *tm)
old_tz = getenv ("TZ"); old_tz = getenv ("TZ");
/* FIXME: there's no way to report this error to the caller. */ /* FIXME: there's no way to report this error to the caller. */
if(setenv("TZ", "UTC", 1) != 0) if(g_setenv("TZ", "UTC", 1) != 0)
PERR ("couldn't switch the TZ."); PERR ("couldn't switch the TZ.");
result = mktime (tm); result = mktime (tm);
if(old_tz) if(old_tz)
{ {
/* FIXME: there's no way to report this error to the caller. */ /* FIXME: there's no way to report this error to the caller. */
if(setenv("TZ", old_tz, 1) != 0) if(g_setenv("TZ", old_tz, 1) != 0)
PERR ("couldn't switch the TZ back."); PERR ("couldn't switch the TZ back.");
} }
else else
{ {
/* FIXME: there's no way to report this error to the caller. */ /* FIXME: there's no way to report this error to the caller. */
unsetenv("TZ"); g_unsetenv("TZ");
if(errno != 0) if(errno != 0)
PERR ("couldn't restore the TZ to undefined."); PERR ("couldn't restore the TZ to undefined.");
} }

View File

@ -14,9 +14,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <dirent.h> #include <dirent.h>
#ifndef HAVE_SETENV
#include "setenv.h"
#endif
#include "gnc-module.h" #include "gnc-module.h"
#include "gw-gnc-module.h" #include "gw-gnc-module.h"
@ -143,7 +140,7 @@ gnc_module_system_setup_load_path(void)
} }
g_list_free(dirs); g_list_free(dirs);
if(setenv("LD_LIBRARY_PATH", envt, 1) != 0) if(g_setenv("LD_LIBRARY_PATH", envt, 1) != 0)
{ {
g_warning ("gnc-module failed to set LD_LIBRARY_PATH"); g_warning ("gnc-module failed to set LD_LIBRARY_PATH");
} }