From: short <> Date: Sun, 26 Jun 2005 06:18:17 +0000 (+0000) Subject: Cleanup getenv(3) by GLib compatible functions. X-Git-Tag: udpgate-1_0_2~14 X-Git-Url: https://git.jankratochvil.net/?p=udpgate.git;a=commitdiff_plain;h=806d202b9f9bc9ba3276bc764eee6f42e4e7f472 Cleanup getenv(3) by GLib compatible functions. --- diff --git a/src/configuration.c b/src/configuration.c index 8be581b..4d80328 100644 --- a/src/configuration.c +++ b/src/configuration.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -54,8 +55,8 @@ static const gchar *static_pathname; G_STRINGIFY(SYSCONFDIR) "/sysconfig",PACKAGE, G_STRINGIFY(SYSCONFDIR) "/default",PACKAGE, G_STRINGIFY(SYSCONFDIR) "",PACKAGE, - /* 'getenv("HOME")' may return NULL and terminate the list prematurely. */ - getenv("HOME"),"." PACKAGE "rc", + /* g_get_home_dir() may return NULL and terminate the list prematurely. */ + g_get_home_dir(),"." PACKAGE "rc", NULL); } diff --git a/src/network.c b/src/network.c index 838e80a..07a3061 100644 --- a/src/network.c +++ b/src/network.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "network.h" #include "packet.h" @@ -63,10 +64,10 @@ static const gchar *static_pathname; static const char *user_val; if (!static_pathname) - user_val=getenv("USER"); + user_val=g_get_user_name(); return pathname_find(&static_pathname, G_STRINGIFY(LOCALSTATEDIR) "/run",PACKAGE ".pid", - (!user_val ? NULL : "/tmp"), + (!user_val ? NULL : g_get_tmp_dir()), (!user_val ? NULL : udpgate_printf_alloca(".%s-%s.pid",user_val,PACKAGE)), NULL); }