From c58f33940138291ef29fc391030e50e45e7e4782 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 25 Dec 2007 02:07:48 +0000 Subject: [PATCH] Fix the environment handling. (#504829, Cosimo Cecchi) 2007-12-24 Matthias Clasen * gdesktopappinfo.c (g_desktop_app_info_launch): Fix the environment handling. (#504829, Cosimo Cecchi) svn path=/trunk/; revision=6200 --- gio/ChangeLog | 9 +++++++-- gio/gdesktopappinfo.c | 17 ++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/gio/ChangeLog b/gio/ChangeLog index 779fc1bcd..6f1636e41 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,8 +1,13 @@ +2007-12-24 Matthias Clasen + + * gdesktopappinfo.c (g_desktop_app_info_launch): Fix the + environment handling. (#504829, Cosimo Cecchi) + 2007-12-22 Matthias Clasen - * gio/gappinfo.c: Doc improvements + * gappinfo.c: Doc improvements - * gio/gdesktopappinfo.c (g_app_info_get_all): Return app infos, + * gdesktopappinfo.c (g_app_info_get_all): Return app infos, not ids. 2007-12-20 Matthias Clasen diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c index c89ae9b2a..241e37f4a 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c @@ -810,6 +810,16 @@ dup_list_segment (GList *start, return g_list_reverse (res); } +#ifdef HAVE__NSGETENVIRON +#define environ (*_NSGetEnviron()) +#elif !defined(G_OS_WIN32) + +/* According to the Single Unix Specification, environ is not in + * * any system header, although unistd.h often declares it. + * */ +extern char **environ; +#endif + static gboolean g_desktop_app_info_launch (GAppInfo *appinfo, GList *files, @@ -862,7 +872,12 @@ g_desktop_app_info_launch (GAppInfo *appinfo, if (display || sn_id) { - envp = g_listenv (); +#ifdef G_OS_WIN32 + /* FIXME */ + envp = g_new0 (char *, 1); +#else + envp = g_strdupv (environ); +#endif if (display) envp = replace_env_var (envp,