Cleanup getenv(3) by GLib compatible functions.
[udpgate.git] / src / network.c
index 838e80a..07a3061 100644 (file)
@@ -35,6 +35,7 @@
 #include <glib/galloca.h>
 #include <glib/gprintf.h>
 #include <glib/grand.h>
+#include <glib/gutils.h>
 
 #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);
 }